Cart items update / Page reload

Hello and thank you for such a great theme!

Recently we tried to add a cart items counter on a ‘Cart’ button.
But it only updates properly from product pages (also it reloads the page here). When we use ‘Add to cart’ button from the ‘Shop’ page it only works for Mini cart widget (and it does’nt reload a page here).
We assume some problem with AJAX, and want to ask you, if you know this problem already.

Can you help us with this?

Kind regards,

Hi There,

Can you give us more description of the issue? I am a little confuse. Are you referring to Enable AJAX add to cart buttons on archives functionality? As stated, it will only work on archives like shop page. Please do give us detailed instruction on how we can duplicate the issue so we can better understanding.

We can give you an access to staging setup with a description. So you can look at it. Is it possible?

The AJAX add to cart and animation will only work in the Shop page and other pages. In single product pages, it is not available and after adding to cart, the page will reload and a notification will appear with the link to view the cart. If you want AJAX functionality and animation in a single product page, you’ll either need a third party plugin or hire a web developer to build a custom function for you.

If I’m not understanding you correctly, please provide a screencast or details of how we can replicate this issue.

Thanks.

Hello Xian,
thank you for the reply!

We are talking not about animation.

Recently we tried to add a cart items counter on a ‘Cart’ button.
But it only updates properly from product pages (also it reloads the page here). When we use ‘Add to cart’ button from the ‘Shop’ page it (counter) only works for Mini cart widget (and it does’nt reload a page here).

Maybe we can give you an access to see it at staging setup, so you will have a better understanding?

Kind regards,

Hi there,

What do you mean by pages here? I’m not sure which specific page. It seems to work on home page and shop pages, and there is no reloading. Would you mind providing a video recording of those pages while testing it? And yes, please provide the access in a secure note in case I need to check further.

Thanks!

Hello Iam.
i just provided an access in a secure note.
Please look and you will understand what i mean.
By pages i mean product pages, shop page and home page.
We are not talking about the animation.
I mean the counter update on a ‘Cart’ button it works on a product page with reload.
But it does not work on a Home page and Shop page as reload does not happen.

Kind regards,

Hi there,

It seems to be random, I added 2 products and it remains 0 counts even by manually reloading it. Then after a couple of minutes, it displays 2 counts. Then I added another product and reloaded it, and it displays 1 counts.

Trying it on my installation but I don’t understand how you set it up, would you mind providing your admin login credentials too? And what’s the login URL?

Thanks!

Hello Iam,
thank you for support.

You can find the code in anchor.php of pro-child theme.
Please look for lines 72 and 74.

Kind regards,

Thanks, how about the admin login credentials and the login URL? You provided htaccess authentication credentials and FTP credentials. I need to check how you setup your headers first.

Thanks!

Hello Iam,
thank you for support!

I have just updated the details.

Hi there,

Have you just changed your menu cart setup? There is no count now and just a normal cart buttons. It’s different from what I’m testing before. Could you try putting it back? But if you preferred it that way then it’s okay too.

I’ll stop troubleshooting for now since there is nothing to test, the items are now correctly adding to the cart too.

Thanks!

Hi Iam,

the counter is still exist on staging setup. We just disabled it on live.

Also we removed ‘Add to cart’ button from Shop page, it’s only available now on a product page. So i just made this changes on staging setup also.

But i think, maybe we need to enable counter on live setup for tests. As the cache mechanism is different from live to staging. What you think?

Thanks for you support.

Hi there,

Yes, I can see the count now in the staging, that’s weird.

Yes, please enable the counter in live site and maybe it’s the cache the one causing the issues on the live site. It works pretty well in the staging, the counter is now displaying the count immediately (not the same on the live site where I get 1 count when I added two products).

But I have a question, how did you setup that car button’s count? All I could find is custom code in your child theme’s functions.php but not related to that button. Or maybe I’m just missing something. And change that button setting trigger errors so there must be some integration added to it. But one thing for sure, the button isn’t connected to the products on the home page, something you can only fix by further customization (shortcodes related) which you may need some help from developers.

Thanks.

Hi Iam,
counter is enabled on live setup. You can try.

I did it with some PHP in our child theme:
/themes/pro-child/framework/views/partials/anchor.php

And that code in functions.php was placed, when we tried to figure out the problem.

Thank you,

Hi there,

Ah, that’s why it’s not visible in the admin. I tried connecting through FTP but I can’t connect, is there any special procedure? I tried different combination and still can’t connect, maybe it’s due to your site’s firewall.

If not possible, please provide your custom files.

I’m not promising any fix, I just like want to see it’s something wrong with the code and maybe I could provide the recommendation. But one thing is sure, the custom code is not connected to the products on the home page since (it’s part of the Woocommerce shortcode). So it needs further customization that we can’t cover.

Thanks!