Conflict with woocommerce_cart_calculate_fees
-
I try to add a custom fee in the cart based on what products have been added there. The problem is that even if I set to make the fees TAX free, it doesn’t work. I disabled all the plugins and themes and found that Woocommerce Germanized plugin is the issue.
Any fix?
This is my code on functions.php file
function woo_add_cart_fee( $cart ) { $total = 0; foreach(WC()->cart->get_cart() as $cart_item_key => $values) { $_product = $values['data']; if( $_product->product_type == 'my_type' ) { $total += $_product->price; } } if ($total >= 50) { $fee = 50; } elseif ($total > 0) { $fee = 30; } else { $fee = 0; } WC()->cart->add_fee( 'Fees: ', $fee, false); } add_action( 'woocommerce_cart_calculate_fees', 'woo_add_cart_fee' );
https://www.ads-software.com/plugins/woocommerce-germanized/
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Conflict with woocommerce_cart_calculate_fees’ is closed to new replies.