Can someone please help me understand why my cart icon link is pointing to /?wc-ajax=get_refreshed_fragments instead of /cart?
This happens on the cart, checkout, shop and product category pages. On the actual product pages it points correctly to the correct /cart url. However when you add a product to cart, it then points to /?wc-ajax=get_refreshed_fragments.
This issue does not occur on any other pages.
Is there a conflict JavaScript or AJAX on these pages?
]]>I’ve added code in the functions php to remove this call anywhere where there’s no add to cart button (i.e everywhere except product pages) and that works fine for those pages. I’m still stuck with it on product pages however, and the extra second or two it takes to load every page is causing me issues with Google Core Web Vitals etc.
In LS, I currently minify JS, do not combine, and defer all JS, as delayed causes issues. I would like to delay just the cart fragments script, but when I add it in the JS Delayed Includes box, it doesn’t work.
I add the following:
cart–fragment.min.js
cart–fragment.js
By all accounts, this should delay the call until an action is performed on the screen, but it doesn’t delay, the script still runs on page load. I’ve tried clearing cache etc., this is not the issue either.
Am I missing something important? Any idea how I can get this to work?
Thanks.
]]>cart-fragments
script to specific pages (shop page and products only). It doesn’t make any sense as you’d want to show the cart content on all pages except the cart and checkout pages only… since a few versions we have a weird and random problem, when an order is placed the cart seems emptied on the “thank you” page, but as soon as another page (and cart fragments) is called, the items just ordered reappear in cart.
Server is OpenLitespeed with PHP 7.4
LScache is enabled
Redis is enabled
OPCache is enabled
WP 5.6.1
WC 5.0.0 and 4.9.2
ATUM 1.8.5
/*** What we already tried (with no success): ***/
– if we disable ATUM plugin the wrong behaviour immediately disappears
– we disabled all plugins, including LSCache, and only kept Woocommerce and ATUM. No success. Again, as soon as we disable ATUM the problem disappears.
– we tried with two themes, quite an old one (VG Donnan) that works since years on our woocommerce, and a brand new installation of Blocksy on a test server.
– tried to clean all transients, both expired and not expired.
– tried to clean all browser cache, including cookies and local storage
– apparently the problem does not appear to all customers (we have thousands), but only in an apparently random way…
– We do NOT have Cloudflare enabled
– We disabled PHP OPcache and Redis
– We installed old versions of ATUM down to 1.7.9 (we do not remember exactly since when the problem started…)
– The PHP logs do not show any particular error
– The cart cookies are correctly removed when order is placed but immediately reappear as soon as another page is loaded (probably by cart-fragments?)
It’s quite urgent as we hve more than 10.000 products, and to manage them with only the normal products list on Woocommerce it’s almost undoable.
Thanks in advance!
]]>I like your plugin, until now I created my own dequeue files, but you have really optimized it. One improvement note from my side: The way you are dequeue-ing the cart script (:763 – :797) is not working for many themes. Your approach to dequeue wc-cart-fragments creates empty ajax carts in the header after adding it to the cart for example, as many themes are leaning on this. Also, when I enable Disable WooCommerce scripts and styles it also dequeue’d cart fragments, while Disable WooCommerce Cart Fragments is not being enabled. I’d separate them, because when you have a conflict with Cart Fragments you also cannot use Disable WooCommerce scripts and styles.
Regarding the cart fragment not working with themes; I would suggest to take a look at the plugin “disable cart fragments”. This one is really optimized and is working almost with every environment. I would implement this. For now I have removed the lines :763 – :797 and enabled this plugin.
I hope you will consider these improvements.
Thanks,
Demian
Not sure about @technisolutions comment regarding older versions of WooCommerce. We’re running Woo 4.0.1 and it works for us. ‘wc-ajax=get_refreshed_fragments’ is no longer in the Waterfall of GTmetrix for our homepage.
Thank you.
]]>since the recent major woocommerce update, however, it seems to no longer work.
I ran a pingdom test and it has shown that cart fragments took 1.98s to load.
Is this a common problem since the woocommerce update?
]]>