• Resolved darkhousedevelopment

    (@darkhousedevelopment)


    I have a free gift being added to a virtual product. The free gift itself is also a virtual product, an ebook. If I add my subscription product to cart without a free gift applied, there is no shipping in the order. If I select the free gift itself and add it to cart there is no shipping in checkout. However, if I apply this free gift to this virtual product then suddenly there is shipping applied at checkout.

    I am using WooCommerce Multiple Free Gift PRO v1.0.4

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter darkhousedevelopment

    (@darkhousedevelopment)

    To add to this post, here is a print_r of $cart_item on the checkout screen of the free gift item. It appears that your plugin creates a variation product that by default has shipping on it.

    cart_item = Array
    (
        [product_id] => 205173
        [variation_id] => 376932
        [variation] => Array
            (
                [Type] => Free Item
            )
    
        [quantity] => 1
        [line_total] => 0
        [line_tax] => 0
        [line_subtotal] => 0
        [line_subtotal_tax] => 0
        [line_tax_data] => Array
            (
                [total] => Array
                    (
                    )
    
                [subtotal] => Array
                    (
                    )
    
            )
    
        [data] => WC_Product_Variation Object
            (
                [variation_id] => 376932
                [parent] => WC_Product_Simple Object
                    (
                        [id] => 205173
                        [post] => WP_Post Object
                            (
                                [ID] => 205173
                                [post_author] => 69051
                                [post_date] => 2016-05-16 12:51:20
                                [post_date_gmt] => 2016-05-16 02:51:20
                                [post_content] => […]
                                [post_title] => 5 Ingredients or Less eBook
                                [post_excerpt] => 
                                [post_status] => publish
                                [comment_status] => open
                                [ping_status] => closed
                                [post_password] => 
                                [post_name] => under-5-ingredients-ebook
                                [to_ping] => 
                                [pinged] => 
                                [post_modified] => 2016-06-08 13:43:19
                                [post_modified_gmt] => 2016-06-08 03:43:19
                                [post_content_filtered] => 
                                [post_parent] => 0
                                [guid] => https://mysite.com/?post_type=product&p=205173
                                [menu_order] => 0
                                [post_type] => product
                                [post_mime_type] => 
                                [comment_count] => 0
                                [filter] => raw
                            )
    
                        [product_type] => simple
                        [shipping_class:protected] => 
                        [shipping_class_id:protected] => 0
                        [total_stock] => 
                        [supports:protected] => Array
                            (
                                [0] => ajax_add_to_cart
                            )
    
                        [tax_status] => taxable
                        [manage_stock] => no
                    )
    
                [variation_shipping_class] => 
                [variation_shipping_class_id] => 0
                [variation_has_sku] => 1
                [variation_has_length] => 1
                [variation_has_width] => 1
                [variation_has_height] => 1
                [variation_has_weight] => 1
                [variation_has_tax_class] => 1
                [variation_has_downloadable_files] => 1
                [variation_level_meta_data:protected] => Array
                    (
                        [downloadable] => no
                        [virtual] => no
                        [manage_stock] => no
                        [sale_price_dates_from] => 
                        [sale_price_dates_to] => 
                        [price] => 
                        [regular_price] => 
                        [sale_price] => 
                        [stock] => 0
                        [stock_status] => instock
                        [downloadable_files] => Array
                            (
                            )
    
                    )
    
                [variation_inherited_meta_data:protected] => Array
                    (
                        [tax_class] => 
                        [backorders] => no
                        [sku] => 
                        [weight] => 
                        [length] => 
                        [width] => 
                        [height] => 
                    )
    
                [id] => 205173
                [post] => WP_Post Object
                    (
                        [ID] => 205173
                        [post_author] => 69051
                        [post_date] => 2016-05-16 12:51:20
                        [post_date_gmt] => 2016-05-16 02:51:20
                        [post_content] => […]
                        [post_title] => 5 Ingredients or Less eBook
                        [post_excerpt] => 
                        [post_status] => publish
                        [comment_status] => open
                        [ping_status] => closed
                        [post_password] => 
                        [post_name] => under-5-ingredients-ebook
                        [to_ping] => 
                        [pinged] => 
                        [post_modified] => 2016-06-08 13:43:19
                        [post_modified_gmt] => 2016-06-08 03:43:19
                        [post_content_filtered] => 
                        [post_parent] => 0
                        [guid] => https://mysite.com/?post_type=product&p=205173
                        [menu_order] => 0
                        [post_type] => product
                        [post_mime_type] => 
                        [comment_count] => 0
                        [filter] => raw
                    )
    
                [product_type] => variation
                [shipping_class:protected] => 
                [shipping_class_id:protected] => 0
                [total_stock] => 
                [supports:protected] => Array
                    (
                    )
    
            )
    
    )
    Thread Starter darkhousedevelopment

    (@darkhousedevelopment)

    And just for comparison, this is a print_r of that same exact item in a cart where it was added as a regular product, and not as a free gift.

    cart_item = Array
    (
        [product_id] => 205173
        [variation_id] => 0
        [variation] => Array
            (
            )
    
        [quantity] => 1
        [line_total] => 0
        [line_tax] => 0
        [line_subtotal] => 0
        [line_subtotal_tax] => 0
        [line_tax_data] => Array
            (
                [total] => Array
                    (
                    )
    
                [subtotal] => Array
                    (
                    )
    
            )
    
        [data] => WC_Product_Simple Object
            (
                [id] => 205173
                [post] => WP_Post Object
                    (
                        [ID] => 205173
                        [post_author] => 69051
                        [post_date] => 2016-05-16 12:51:20
                        [post_date_gmt] => 2016-05-16 02:51:20
                        [post_content] => [...]
                        [post_excerpt] => 
                        [post_status] => publish
                        [comment_status] => open
                        [ping_status] => closed
                        [post_password] => 
                        [post_name] => under-5-ingredients-ebook
                        [to_ping] => 
                        [pinged] => 
                        [post_modified] => 2016-06-08 13:43:19
                        [post_modified_gmt] => 2016-06-08 03:43:19
                        [post_content_filtered] => 
                        [post_parent] => 0
                        [guid] => https://mysite.com/?post_type=product&p=205173
                        [menu_order] => 0
                        [post_type] => product
                        [post_mime_type] => 
                        [comment_count] => 0
                        [filter] => raw
                    )
    
                [product_type] => simple
                [shipping_class:protected] => 
                [shipping_class_id:protected] => 0
                [total_stock] => 
                [supports:protected] => Array
                    (
                        [0] => ajax_add_to_cart
                    )
    
                [price] => 0.00
                [tax_status] => taxable
                [stock_status] => instock
                [manage_stock] => no
                [virtual] => yes
            )
    
    )
    Plugin Author Ankit Pokhrel

    (@ankitpokhrel)

    It turns out to be a bug. It is already resolved and will be available in next release.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Free Gift automatically adds shipping cost when item and free gift are virtual’ is closed to new replies.