View Categories

Cart Not Updating Totals After Using Coupon URL

Problem Description #

Customer clicks the coupon URL, the coupon seems to be applied (or cookie present), but the cart totals and displayed prices do not reflect the discount until a manual page refresh or further action.

Symptoms #

  • Coupon shows in cookie or in applied coupons list but totals remain unchanged.
  • AJAX cart fragments fail to refresh; single-page carts don’t show changes.

Typical cause #

Theme or plugin does not refresh WooCommerce cart fragments or Ajax/cart-update calls are blocked by caching, resulting in stale cart HTML being displayed. Block editor/checkout/cart blocks and page builders may also require different hooks.

Solution-step-by-step #

  1. Reproduce the issue
    1. Open a clean browser or incognito window.
    2. Visit the coupon URL and then go to the cart page. Note whether the totals show the discount.
  2. Force reload / refresh cart fragments
    1. As a short test, manually refresh the cart page (F5). If totals update after refresh, the issue is almost certainly a cart-fragment / caching problem.
  3. Check for caching of cart fragments
    1. Ensure your cache plugin or CDN doesn’t cache dynamic cart fragments. For many caching solutions, you should exclude ? queries or /cart, /checkout pages from cache.
    2. Purge cache and test again. WordPress.org
  4. Disable/minimize scripts that prevent Ajax
    1. Some performance plugins defer or delay JavaScript; this can block the cart fragment refresh. Disable JS deferral for frontend/cart scripts and test.
    2. If you use asset optimization, disable it for WooCommerce scripts temporarily.
  5. Test theme and plugin conflicts
    1. Switch to a default theme and deactivate other plugins except WooCommerce and coupon plugin. If it works, re-enable components to isolate the conflict. WordPress.org
  6. Apply a manual “refresh cart” snippet (if needed)
    1. If your theme does not trigger cart fragment updates, add a small JS snippet to force refresh the cart after the coupon is applied (requires developer / theme edits):

jQuery( function($){

  // After coupon applied event – this example fires after the plugin sets cookie or queue

  $(document).on(‘coupon_applied_event’, function(){

    // request cart fragments update

    $.ajax({

      url: wc_cart_fragments_params.ajax_url,

      type: ‘POST’,

      data: { action: ‘woocommerce_get_refreshed_fragments’ }

    }).done( function(response){

      if ( response && response.fragments ) {

        $.each(response.fragments, function(key, val){

          $(key).replaceWith(val);

        });

      }

    });

  });

});

    1. Important: Use the plugin’s actual event name or trigger the refresh after the code that sets the cookie — you may need a developer to adapt this snippet. (Use safely in a child theme or custom plugin.)
  1. Consider redirecting to cart page after applying coupon
    1. If the plugin supports a redirect to cart after applying the coupon, enable it in plugin settings so the cart page loads with fresh totals (less reliance on fragments). WPFactory

Prerequisites #

  • Working WooCommerce AJAX setup (no blocked admin-ajax).
  • If using optimization plugins, be able to exclude WooCommerce scripts.

Additional notes #

  • The robust long-term fix is to ensure cart fragments are supported and not cached and to avoid deferring core WooCommerce JS.

For block-based carts, ensure plugin supports WooCommerce Blocks or provide a custom handler.

 

Coupon & Discount by User Role for WooCommerce