• Resolved Sammy

    (@samr17)


    Hello Forum,

    i have added a 19% to the shipping price in the wocoommerce settings. the problem is that the shpping taxes also appearing (see link) when there is no shipping price.

    for example:
    the customer adding a 0€ free product (with a shipping class) to his cart. as soon as the customer is adding another product to the cart, all shipping costs are set to zero via PHP: $rate->cost = 0. (see code bellow)

    how can i avoid the 19% taxes when the shipping is set to zero ? Thank you!

    function adjust_shipping_rate( $rates ){
    global $woocommerce;
    global $free_product_id;

    $cart_counter = 0;

    foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
    $cart_counter += 1;
    }

    $product_ids = array_merge(
    wp_list_pluck(WC()->cart->get_cart_contents(), ‘variation_id’),
    wp_list_pluck(WC()->cart->get_cart_contents(), ‘product_id’)
    );

    if ( $cart_counter > 1 && in_array($free_product_id, $product_ids)){

    foreach ($rates as $rate) {
    $rate->cost = 0;
    }

    }
    return $rates;
    }
    add_filter( ‘woocommerce_package_rates’, ‘adjust_shipping_rate’, 50, 1 );`

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Shaun Kuschel a11n

    (@shaunkuschel)

    Automattic Happiness Engineer

    Hey @samr17,

    Can you explain a bit more about the scenario that you’re trying to achieve so I can make sure that I understand it correctly?

    Thread Starter Sammy

    (@samr17)

    Hello Shaun,

    thank you for your feedback.

    Through an campaign the customer should be able to purchase an “free beeskin” product for 0€ without shipping. As long as he has another product in his cart. (for this case i use an rate=0 hook function in the functions.php)
    If the customer wants “free beeskin” 0€ only without any other product in his cart, 4€ shipping costs should be exclusively added. All other products are shipping free.

    Plugin Support Shaun Kuschel a11n

    (@shaunkuschel)

    Automattic Happiness Engineer

    Hey @samr17,

    Thanks for providing the additional clarification. The only part I still have a question regarding is this:

    All other products are shipping free.

    Is this for the campaign only? Or are all products in the store free to ship normally?

    Thread Starter Sammy

    (@samr17)

    thanks for your feedback.

    > Is this for the campaign only? Or are all products in the store free to ship normally?

    all products are shipping free by default.

    Plugin Support Shaun Kuschel a11n

    (@shaunkuschel)

    Automattic Happiness Engineer

    Hey @samr17,

    Since the 19% tax is built into the 4€ shipping cost and all products have free shipping by default, I would try doing some tests with the “Shipping tax class” set to “Zero rate” on the WooCommerce > Settings > Tax > Tax options page and see if that removes the additional shipping tax.

    If that doesn’t work, let me know.

    Thread Starter Sammy

    (@samr17)

    Hello Shaun,
    thank you for your help,
    i will try it with the Tax Option & report back.

    Plugin Support Shaun Kuschel a11n

    (@shaunkuschel)

    Automattic Happiness Engineer

    Sounds good, @samr17! Let me know how it goes. 🙂

    Plugin Support Shaun Kuschel a11n

    (@shaunkuschel)

    Automattic Happiness Engineer

    Hey @samr17,

    Since it’s been a little while since the last update, I’m going to close this thread. However, if you have any other questions after try the suggestion above, feel free to start a new thread (so that we’ll be sure to see it). Thanks!

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Shipping Tax’ is closed to new replies.