WooCommerce AJAX and known incompatibility

Hello Themeco!
We’re using X / Pro on many websites and it’s great.

On two different sites with WooCommerce, we’ve noticed that the AJAX (wc_fragments?) doesn’t work as expected and also realized that X or Pro aren’t compatible with the latest WooCommerce version (4.3.0) according ot the documentation.

We can’t revert WooCommerce at this point (it would possibly require a database rollback). We’re wondering if we’re the first to encounter this issue or if there are any fixes we could apply in the theme’s files (we’re developers).

See case #1 (native add to cart on the pictures + cart AJAX refresh): https://www.leterroirdejules.ca/boutique/fromages/

See case #2 (cart AJAX refresh): https://www.restaurantretro50.ca/commande-en-ligne-2
Add any burger using the WooFood popup and then manually refresh the page (the cart is on the right).

If you see something we’re missing, let us know!

Suggestion: Add a warning when updating plugins that shows the maximum compatible version for the corresponding theme version based on this: https://theme.co/docs/version-compatibility

Hi @magikweb,

Thanks for writing to us.

There are a few reasons for AJAX issues.
You may have disabled the " Enable AJAX add to cart buttons on archives" in the settings.
Please check it in WooCommerce > Settings > Products > General > Add to cart behaviour.

You may need to increase the memory limit by adding the following code to the wp-config.php file.

define( 'WP_MEMORY_LIMIT', '256M' ); define( 'WP_MAX_MEMORY_LIMIT', '256M' );

Learn how to modify the wp-config.php from this (video)[https://www.youtube.com/watch?v=3SDPTafEM8o&feature=youtu.be]

We found that you are using the Child Theme, and a modified child theme is composed of custom codes.
Please note that we don’t troubleshoot any custom codes.
Please check if the issue is coming from your child theme by following this article : https://theme.co/docs/common-issues#child-theme

Hope it helps

1 Like

Thank you for the follow-up!

I validated using case #1 and it’s more of a visual problem. Adding items to the cart works and the cart counter changes (in the right menu), but shouldn’t there be a checkmark showing up like on the demo?
https://demo.theme.co/shop-integrity/

  1. “Enable AJAX add to cart buttons on archives” is checked.
  2. The memory limit was increased (in case there could be a link, but there are no limit exceeded errors in the logs).
  3. The problem happens with the native theme (without child theme). We re-enabled the child-theme after our tests.

Related question for case #2; is the WooCommerce cart shortcode ([woocommerce_cart]) overridden by Pro’s theme? It’s the one that is not refreshing if you look at the bottom left of this page after adding products: https://www.restaurantretro50.ca/commande-en-ligne-3
The working one is the native cart widget.

Thank you for your help, it’s greatly appreciated.

Hello @MagikWeb,

Thanks for the updates. I have tested both the sites and I can confirmed an issue with leterroirdejules.ca site. This could be because of caching. After doing the updates, always remember to clear all caches since you are using WP Rocket so that the code from the latest release is always in use. This will help you to avoid any potential errors. And please clear your browser cache too. You may use private browsing mode in testing your site to make sure that you are viewing the latest codes from the updates and not the cached version in your browser.

This links might help:

Meanwhile, on the www.restaurantretro50.ca site, I do not experienced any issue. After adding the item, it reflects to the shopping cart as shown in the screenshot below.

Kindly make sure to clear all your caches first and the test your sites again. It would also help if you temporarily disable any caching or optimizing plugins such as W3 Total Cache, WP Rocket, Autoptimize, etc.

Best Regards.

1 Like

Thank you very much for taking the time!
Just to clarify, it added the product asynchronously in the “Panier Shortcode” on your end?

I tried on Chrome, Firefox and Brave using empty sessions and I always end up with this result (after adding a product without refreshing):
image

We disabled CloudFlare, SuperCacher (SiteGround) and WP Rocket.

Hello @MagikWeb,

To better assist you with your issue, kindly provide us access to your site so that we can check your settings. Please create a secure note with the following info:
– Link to your site
– WordPress Admin username / password

To know how to create a secure note, please check this out: How The Forum Works

Best Regards.

Secure note added!

Thanks again.

Hey @magikweb,

The issue here is that the systems you’re currently using don’t support AJAX.

For the 1st site, https://www.leterroirdejules.ca/boutique/fromages/`

  1. The problem with that is you’re using [products] shortcode in a page so it’s not really an archive page and so our theme’s setting won’t work for it.
  2. You’re using a different system for the cart in the menu. Please use our X or the Original Header’s WooCommerce Menu which you can configure in Theme Options > WooCommerce. Enable Navbar Menu
    image

For the 2nd site, https://www.restaurantretro50.ca/commande-en-ligne-2

  1. You’re using the [woocommerce_cart] shortcode and that doesn’t support AJAX. Please use a Text or Button element and within it, add the Cart Item Count and Cart Total [Dynamic Content](https://theme.co/docs/work-with-dynamic-content).

image

I did test what I suggested here using the latest version of X/Cornerstone and Pro and WooCommerce 4.3.0.

Although, please note that we do not provide support for WooCommerce 4.3.0 yet. If you encounter more issues with it, you can report to us but we cannot fix it right away.

Hope that helps.

1 Like

Thank you Christian,
It did help!

For the moment, my team will use a widget area and put the “main sidebar” in it that contains only the cart widget.
Your suggestion works, but it doesn’t show the content of the cart. If there’s a way to achieve the same thing as the widget, but using dynamic content, let me know.

Thanks again!

Hey @magikweb,

You can add the Text element with the Dynamic Content in a Global Block. See the usage of Global Blocks here https://theme.co/docs/global-blocks

Hope that helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.