View Categories

Shortcode Doesn’t Update Amount on Shop/Product Pages

Table of Contents

Problem Description #

The plugin shortcode (or widget) shows the initial amount left but does not update as items are added/removed from the cart when placed on product/shop pages or header areas.

Common symptoms

  • Shortcode output remains cached; does not reflect current cart value.
  • Works correctly on /cart/ page but not elsewhere.

Cause

  • Cart fragments or dynamic updates are not wired to the shortcode output on non-cart pages. Cart updates often rely on AJAX fragments or WooCommerce cart fragments; if the shortcode is outside the fragment region (or cache is active), it won’t update. WordPress.org

Solution (step-by-step)

  1. Place shortcode in an AJAX-updating fragment: If your theme uses fragments or dynamic areas, insert the shortcode inside that area. For example, place it inside the mini-cart fragment or an element that the theme refreshes on add-to-cart.
  2. Disable fragment caching on that page/element: If using caching plugins, exclude the page or the specific widget from cache. Purge cache.
  3. Use plugin’s built-in mini-cart/automatic injection: If the plugin provides an option to automatically show on the header or shop, enable that setting instead of using raw shortcode (it may handle fragments better).
  4. If you can use Pro AJAX option: Enable AJAX updates (Pro) so the plugin listens to add-to-cart events and updates the shortcode area. WordPress.org
  5. Advanced developer workaround: Use JS to request /cart/ fragment and replace the shortcode container after add-to-cart events — similar concept to Article 1 workaround (developer required).

Prerequisites

  • Cache control access and knowledge of where your theme updates cart fragments.

Additional Notes

  • Test on mobile and desktop; some shortcodes behave differently depending on how the add-to-cart trigger is implemented.

 

Free Shipping Bar: Amount Left for Free Shipping for WooCommerce