• Resolved mxmanuel

    (@mxmanuel)


    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.3

    What needs to be done?

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Contributor alexmigf

    (@alexmigf)

    Hello @mxmanuel

    Fragments aren’t being refreshed on that pages. Are you using any cache plugin?

    Let me know.

    Thread Starter mxmanuel

    (@mxmanuel)

    Could you provide me with any script for the functions.php to enable that?
    I am not using any cache plugins.

    Plugin Contributor alexmigf

    (@alexmigf)

    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.

    Thread Starter mxmanuel

    (@mxmanuel)

    Thanks for your fast reply.
    Yes, it works and…
    unfortunately it creates a misfunction with an other plugin.

    Plugin Contributor alexmigf

    (@alexmigf)

    Hi @mxmanuel

    Can you describe the issue?

    Thread Starter mxmanuel

    (@mxmanuel)

    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
    mxmanuel

    Plugin Contributor alexmigf

    (@alexmigf)

    Hi @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.

    Thread Starter mxmanuel

    (@mxmanuel)

    Thanks again for your willingness to solve my problem, but unfortunately it doesn’t make a change.

    Regards
    mxmanuel

    Plugin Contributor alexmigf

    (@alexmigf)

    Hi @mxmanuel

    Can you show me which buttons don’t work?

    Thread Starter mxmanuel

    (@mxmanuel)

    Ok, I set up the exact same situation at https://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.php

    Hope I could express the situation (my native language is German)

    Thanks
    mxmanuel

    Plugin Contributor alexmigf

    (@alexmigf)

    Hello @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.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Plugin not refreshing number of items’ is closed to new replies.