• Resolved dsm123

    (@shymonk)


    I have added the custom hook to add a discount, when the page loads, the discount is visible, but as soon as page loads, an wc-ajax request makes the cstom discount go away. I am using the latest version of woocommerce. Here is my code,

    add_action('woocommerce_cart_calculate_fees' , function() {
            //global $woocommerce;      
            $discount = WC()->cart->subtotal * -0.1;
    
            WC()->cart->add_fee('Custom', $discount);
    
            });   

    can you please help me with this.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Gerhard Potgieter

    (@kloon)

    I just tested your code on the latest WooCommerce, 3.2.2, with the Storefront theme and the discount fee shows fine and goes through to the order on checkout https://cld.wthms.co/XliONW

    I’d suggest you test with a default theme like Storefront or Twentyseventeen and also with just WooCommerce activated and see if that resolves the issues.

    Chances are your theme or another plugin is causing interference here.

    I have the same issue on my end, commenting here to keep updated.

    Only WooCommerce activated and latest version of Storefront.

    Thread Starter dsm123

    (@shymonk)

    Hey Andrew,
    My issue got resolved after the Woocommerce update (to 3.2.2)
    Now I am using v3.2.3 I am not facing that issue.
    Kindly check if once after updating the plugin!!

    Thanks.

    • This reply was modified 7 years, 4 months ago by dsm123.

    Thanks, managed to figure it out! Was doing some advanced calc. to add stuff in! ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom fee disappearing on checkout page by ajax update’ is closed to new replies.