Plugin not refreshing number of items
-
Dear developers,
when I add a product in the single product view the number of items in your plugin doesn’t refresh. I am using Version 2.9.3What needs to be done?
The page I need help with: [log in to see the link]
-
Hello @mxmanuel
Fragments aren’t being refreshed on that pages. Are you using any cache plugin?
Let me know.
Could you provide me with any script for the functions.php to enable that?
I am not using any cache plugins.Hello @mxmanuel
Try adding this to your theme functions.php file:
add_action( 'wp_footer', 'wpo_refresh_fragments' ); function wpo_refresh_fragments() { ?> <script> jQuery( function ($) { $('form.cart').on('submit', function() { setTimeout(function(){ $( document.body ).trigger( 'wc_fragment_refresh' ); },5000); }); }); </script> <?php }Let me know.
Thanks for your fast reply.
Yes, it works and…
unfortunately it creates a misfunction with an other plugin.Hi @mxmanuel
Can you describe the issue?
Yes, thanks for asking:
I am using the plugin “WooCommerce Menu Cart” on the page https://www.senfmuehle.net/bestellformular.
When a customer puts a new item into the cart two more buttons appear.
When I use the script you providet me with, these buttons do not function as links.
Just after refreshing the page, the links become active.Regards
mxmanuelHi @mxmanuel
Try this one instead:
add_action( 'wp_footer', 'wpo_refresh_fragments' ); function wpo_refresh_fragments() { if ( is_singular( 'product' ) ) { ?> <script> jQuery( function ($) { $('form.cart').on('submit', function() { setTimeout(function(){ $( document.body ).trigger( 'wc_fragment_refresh' ); },5000); }); }); </script> <?php } }Let me know.
Thanks again for your willingness to solve my problem, but unfortunately it doesn’t make a change.
Regards
mxmanuelHi @mxmanuel
Can you show me which buttons don’t work?
Ok, I set up the exact same situation at http://www.coneso.de/senfmuehle/bestellformular/ since the other URL is a live site and the customer…
Once you added an item via this order form two more buttons will appear.
As long as you don’t refresh the page they woun’t work as links.
Your second script is in the functions.phpHope I could express the situation (my native language is German)
Thanks
mxmanuelHello @mxmanuel
I don’t believe the problem is from my code snippet because it’s not loaded on that page, only on products page. The problem should be somewhere else.
The topic ‘Plugin not refreshing number of items’ is closed to new replies.