All things Shopify and commerce
https://codeshare.io/pAAolE this is my current code which results in this:
But when I switch color (Grijs -> Zwart) for example all text is removed can anyone help me so that that doesn't happen? Thanks in advance
The text that gets deleted is this part
so the text from the code but how can I make it that it doesn’t remove the text when changing variant? The text is not removed when refreshing
Hi,
I could be wrong, but I think a better way to add the text is by adding a custom liquid block to your product page template. It's easy to add one, it can be styled and made to look the way you want it, it can even be made dynamic in case you want to show different messages for different products, and It's sure to appear with all variants on the page.
Hope that helps.
Hello @JohnE10 do you also know if this can be achieved by some code in the main-product-page? Ive tried to add an eventlistener for when the variant changes but it did not work.
I mean main-product.liquid
I'm sure it could depending on the theme/code.
Yeah I got it by updating the product page when the url switches
Thanks for thinking with me tough
You bet. Good to hear you got it working.
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025