Support » Plugin: Giftable for WooCommerce » BUG: in Cart page virtual prod, add virtual prod gift -> shipping costs applied

  • Resolved Annonnimmo


    the bug is present in the cart page:

    only 1 virtual product in the cart

    add a gift that is a virtual product

    it appears shipping cost (as there was a physical product)

    Thank you.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author DecomTeam


    Hi @annonnimmo,
    Could you share a video/showcase with us ?
    – at least some screenshots

    Hi @decomteam,
    sorry… I don’t understand how screenshots could help in this case.

    Does not this bug happen to you simulating the above conditions (1 virtual product + 1 virtual product gift)?

    Or should I better explain?

    Thank you

    Plugin Author DecomTeam


    We need video/screenshots so we can re-produce to see whats happening.
    1. Shipping cost is beacuse your settings (on clean install nothing have shipping cost)
    – so please double check your shipping settings
    2. WooCommerce version, PHP version
    3. Check on CLEAN install (without extra plugins for shipping etc.)
    4. To be able to help you
    – have in mind this plugin is free and we are time limited from time to time

    Hi, I thank you for your free plugin. Be sure that I’m trying to cooperate in the best manner to solve the bug.

    (I understand that you may often answer to newbie, but it’s not the case)

    1) I double checked shipping settings and are correct.
    It’s a long time perfectly working micro e-commerce.
    Without adding a gift with your plugin, when there are only virtual products in the cart, shipping cost correctly doens’t apply.
    Please note that Woocommerce automatically exclude shipping costs when there are in the cart only virtual. It is a logic inside Woocommerce, it doesn’t depend on a setting nor any tweaks.

    2) WordPress 4.9.6 – Woocommerce 3.4.1 – PHP 7.2

    3) No extra plugin for shipping

    Please answer me: you, on a clean install, are not seeing this bug?

    Thank you.

    Plugin Author DecomTeam


    Can you provide access to your sample Website ?
    You can share url to support [at]

    GIFT should be Gift (not virtual + gift),
    Did you try to change Product data: to only GIFT ?
    – if you issue is only there when gift is added

    *I will try to reproduce it, but alot of things can cause such thing, you can even setup “custom shipping class” that you can add to your GIFT (it will exclude it from shipping cost..) if nothing else, quite bunch of variations there, but will try to inspect.


    • This reply was modified 2 years, 2 months ago by DecomTeam.

    Sorry, I’ll not use anymore your plugin and instead I will use this snippet.
    It’s simpler and gave no compatibility problem.

    I hope for other people that you will solve the bug anyway.

    function lucar_add_gift_if_ID_added_cart( $passed, $product_id, $quantity ) {
    	global $woocommerce;
    	/* enter array of ID that give gift */
    	$IDswithgift = array('6083','');
    	/* enter ID of product gift */
    	$giftID = '1860';
    	/* enter name of coupon that gives 100% discount for specific product gift */
    	$coupon_code = 'xxxyyyzzz'; 
    	$product = wc_get_product( $product_id );
    	if ( $product-> get_id() && in_array( $product-> get_id(), $IDswithgift ) ) {
    		WC()->cart->add_to_cart( $giftID );
    		wc_add_notice( __( 'Hey, supporter! As promised, I added the bonus for free', 'woocommerce' ), 'success' );
    		$woocommerce-> cart-> add_discount( $coupon_code );
    	return $passed;
    	add_filter( 'woocommerce_add_to_cart_validation', 'lucar_add_gift_if_ID_added_cart', 10, 3 );

    Thank you anyway

    Plugin Author DecomTeam


    Thank you for trying our plugin @annonnimmo

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘BUG: in Cart page virtual prod, add virtual prod gift -> shipping costs applied’ is closed to new replies.