Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function woo_dm_add_custom_fees(){
- $cart_total = 0;
- foreach( WC()->cart->get_cart() as $item ){
- $cart_total += $item["line_total"];
- }
- $fee = (int)$cart_total*5/100;
- WC()->cart->add_fee( "Credits :", $fee, false, '' );
- }
- add_action( 'woocommerce_cart_calculate_fees' , 'woo_dm_add_custom_fees' );
- add_action( 'woocommerce_after_cart_item_quantity_update', 'woo_dm_add_custom_fees' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement