• Resolved dantekavala

    (@dantekavala)


    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)
  • Plugin Author vendidero

    (@vendidero)

    Hi there,

    did you activate the “force tax calculation for fees” setting under Germanized > General?
    Maybe you need to deactivate the options..

    cheers

    Thread Starter dantekavala

    (@dantekavala)

    Indeed. This works. I admit that I missed this option and for a reason, it was checked. Is there anything I should be aware that this option will affect? Something more than the tax on the fees?

    Plugin Author vendidero

    (@vendidero)

    Hi there,

    not it’s only about the fee taxes.

    cheers

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Conflict with woocommerce_cart_calculate_fees’ is closed to new replies.