fbpx
Enjoy Year-End Sale: 50% Off All Plugins! Coupon Code: NewYear2025

Wrong variation swatches used when switch to USD currency

Eric Embacher

I have a very strange problem.

I have the attributes “Center gemstone”, and have configured it to show colors as the variation swatches. See https://www.dropbox.com/scl/fi/i5xwbnt4uyhhd6u667dxs/CleanShot-2024-08-20-at-22.02.29.jpg?rlkey=9zci8qjiduw2d1el6d6oyaxsn&dl=0

The site has a currency switcher plugin that allows converting prices to any of 4 different currencies. When viewing the site under the default currency (CAD), the swatches appear as intended (colors). See https://www.dropbox.com/scl/fi/pyqoyrw1h14ewn3sdgl4w/CleanShot-2024-08-20-at-22.01.29.jpg?rlkey=k3poreqdtogokicuh0sbivcom&dl=0 . It also appears fine when switching to GBP and AUD currencies.

However, when you switch to USD, all swatches for the Center gemstone attribute no longer use the colors as defined, instead they just show the name of the attribute. See https://www.dropbox.com/scl/fi/4gg99sdowtacqnbz4oqox/CleanShot-2024-08-20-at-22.16.29.jpg?rlkey=8hezoh1z9tzyeexa864w7kqet&dl=0

Why don’t the variation swatches use the colors as defined regardless of the currency being displayed?

See the problem on this page: https://jxj225vmij-staging.onrocket.site/shop/earrings/prong-set-birthstone-earring/

 

Hakik Zaman

Hi Eric,

Thanks for getting back to us.

It is weird and difficult to inspect. It should work if it works for the other currencies.

It could be an issue of caching( server-side cache) of your site. The server-side cache can be flushed from your hosting panel. You can also contact your hosting support to clear your server-side cache.

For a test, you can also add another currency to check if it works for the new currency or not.

Thank You

Eric Embacher

My host uses full-page caching only (Cloudflare) but I’ve tried flushing the cache and disabling it entirely.

I added a new currency, and that one was fine.

I tried removing USD and adding it again—same issue.

I also noticed that in USD and GBP currencies, the “Metal karat” attribute is not using the image that I’ve defined—it’s displaying the swatch as text only.

Hakik Zaman

Hi Eric,

As I said in my last reply, if it works it will work for all currencies.

If it is not, it will not work for the others as well. According to the codebase, there is no chance that it will work partially.

You can try another free currency plugin to test it further. For example: CURCY.

Thank You

Eric Embacher

The evidence is clear: it is working ONLY PARTIALLY. It does not work for all currencies.

Testing another currency switcher plugin is redundant as I use my current one on all websites and own a lifetime license.

Let’s ignore currency for the time being. I’ve encountered a bug whereby the variation swatches are not using the values that are defined. The markup that the plugin is creating is incorrect. As you can see from this screenshot (https://www.dropbox.com/scl/fi/j54e3vplsw37rw0uwd6sf/CleanShot-2024-08-22-at-11.11.54.jpg?rlkey=c92t3oj905pecvz93atpd6f56&dl=0), the swatch element (.variable-item-span-button) which is generated by your plugin does not contain any background color style, which is how this attribute is defined (see https://www.dropbox.com/scl/fi/i5xwbnt4uyhhd6u667dxs/CleanShot-2024-08-20-at-22.02.29.jpg?rlkey=9zci8qjiduw2d1el6d6oyaxsn&dl=0)

Please provide a fix for this bug.

Hakik Zaman

Hi Eric,

Unfortunately, your screenshots are not opening- https://paste.pics/RRK3E

Please login here and try to reproduce your issue for one product. I have added sample products for you here-

https://wptestbox.com/157237/wp-admin/

Username: admin

Password: demo

It will help our development team to inspect it deeply by editing all the files like the WordPress Core and Currency plugin you are using.

Please let me know after replicating the issue for one product. So that I can forward that to our development team.

Thank You

Eric Embacher

I have uploaded the screenshots to your system so you should definitely be able to see them.

I wasn’t able to replicate the issue, but that’s not surprising as it’s a very different environment. The problem also didn’t present itself for several weeks in my own environment.

I tried migrating my site to yours using All In One WP Migration, but your server did not have enough memory to complete the import.

You are welcome to log in and inspect your plugin’s code and why it’s not working properly on my staging site using the login already provided.

Hakik Zaman

Hi Eric,

As you have mentioned it is working on your server and not on the staging site, it is really difficult to inspect unless you replicate the issue for one product on our staging site.

I tried migrating my site to yours using All In One WP Migration, but your server did not have enough memory to complete the import.

You don’t need to copy the whole site, just replicate it for one product.

Thank You

Eric Embacher

I did not say it worked on my production site (it doesn’t).

It is futile trying to replicate it for one product, as your environment is very different than mine. There could be hundreds of reasons why it can’t be replicated in your test environment including the exact configuration of products or attributes, how the server is configured, setup of Woocommerce, etc.

Just because it can’t be replicated in your test environment doesn’t mean there isn’t a bug.

If you can fix the memory issue with your server I could migrate a copy of the site there so we’d be able to make an apples-to-apples comparison and see the problem occurring.

Or, just use my server where the problem is already happening.

Hakik Zaman

Hi Eric,

The problem also didn’t present itself for several weeks in my own environment.

I thought it was working. Sorry if I misinterpret this.

There could be hundreds of reasons why it can’t be replicated in your test environment including the exact configuration of products or attributes, how the server is configured, setup of Woocommerce, etc.

Our Swatches plugin is not dependent on memory. Did you try to replicate this for one product? I have already tried to inspect it on your staging site. The issue was there with activated WooCommerce, Variation Swatches, Variation Swatches – Pro, Aelia Currency Switcher for WooCommerce, and Aelia Foundation Classes for WooCommerce.

Just because it can’t be replicated in your test environment doesn’t mean there isn’t a bug.

Unfortunately, I didn’t tell you anything like this. It helps our development team to access all the code when you replicate it on our testing site. As it is not a common issue, we just wanted your help, nothing else.

Or, just use my server where the problem is already happening.

I will send it to our development team. Unfortunately, I am unable to give a timeline regarding this issue.

Thank You

Eric Embacher

What was done to fix it and how do I avoid it in the future? I don’t use any caching plugins, so I can’t see how it could be a caching issue.

Whatever you did has made the plugin stop working. Selecting a variation now no longer updates the product’s price or image on the Shop page. Can you either fix this, or UNDO what you did earlier, as one bug has now been replaced with a far more serious bug.

Hakik Zaman

Hi Eric,

What was done to fix it and how do I avoid it in the future? I don’t use any caching plugins, so I can’t see how it could be a caching issue.

WooCommerce has its caching facility for attribute terms. So we plan to add this to clear the transient forcefully.

Whatever you did has made the plugin stop working. Selecting a variation now no longer updates the product’s price or image on the Shop page.

It is just the wrapper missing issue. I have added the wrapper as per your archive setup here- https://paste.pics/RSAG0

Now check it here- https://jxj225vmij-staging.onrocket.site/shop/?_category=earrings

As I said, we are still testing it. For further deep testing, please send us another staging with the same issue.

Please be helpful with us.

Thank You

Eric Embacher

Thanks, it’s working again.

If it was just a matter of clearing transients, it’s unfortunate you didn’t mention that several days ago, as I could have done that.

All good for the moment, thanks for the help.

Hakik Zaman

Hi Eric,

If it was just a matter of clearing transients, it’s unfortunate you didn’t mention that several days ago, as I could have done that.

Clearing transient from WooCommerce > Status > Tools will not resolve the issue. So, I didn’t mention it earlier.

Because that doesn’t clear the transient of Attribute Terms. So we decided to add a button as I added in my last reply.

Can you please give us another testing site for final testing? Now the current staging site transient is cleared. So, we are unable to check it further. A new site with that issue will help us to test it accurately.

Hope to hear from you soon.

Thank You

Eric Embacher

If the issue happens again, I’ll give you access to the site. At the moment, the issue is not happening so I have nothing to give you.

Hakik Zaman

Hi Eric,

We need to test the solution as we are not confident yet.

If you are not willing to give a staging site with the same issue, it may happen again.

Now, the issue is at the top of the priority list and this setup will not be the same if it happens again.

Later if it happens, we will not have a similar setup.

Unfortunately, we may have to refund your purchase.

Thank You

Eric Embacher

It’s not that I’m not willing, it’s just that I don’t have a staging site with the same issue currently! The issue is fixed on the only site where I had the problem. If I had a site where it was still occurring, I’d give it to you.

If I experience the issue again, I’ll let you know. But at the moment, it’s working fine.