|
/ Documentation /CartFlows/Code Snippets/ Refresh the Checkout Page After CartFlows AJAX Calls

Refresh the Checkout Page After CartFlows AJAX Calls

In some cases, especially when working with dynamic products like subscriptions, the checkout page may not refresh automatically when switching between products or options. This can lead to a mismatch in available payment methods or shipping options.

To resolve this, CartFlows provides a filter that forces the checkout to refresh and trigger the necessary AJAX calls, ensuring the correct data is always loaded on the checkout page.

This is especially useful when:

  • Switching between subscription and non-subscription products
  • Dynamically changing product options that affect checkout behavior
  • Ensuring updated shipping/payment methods based on the product or variation

How to Enable Checkout Refresh After AJAX Calls

Step 1: Add the Filter to Your Site

To make the checkout page refresh automatically, add the following code to your site’s functions.php file or use a code snippet plugin:

add_filter( 'cartflows_checkout_trigger_update_order_review', '__return_true' );

Need help adding custom code? Here’s how to safely add code snippets to your site.

Step 2: Save and Test

After adding the filter, visit your checkout page and test switching between different product types or options. The page will now refresh the order review section as expected, showing the correct payment methods and other dynamically updated options.

When to Use This Filter

This filter is particularly helpful if you:

  • Use WooCommerce Subscriptions along with other types of products with CartFlows funnel checkout
  • Offer products with conditional logic affecting checkout (e.g., special payment gateways for specific items)
  • Need to ensure the checkout page always reflects the latest data without requiring manual updates/refreshes.
Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
On this page