When I click on Matted & Framed, I would like a certain description to come up and same for Print Only.
I created the following meta fields and not sure what to do. I only need it for a specific collection.
Any help would be appreciated!
So what you want to do is based on the variant option that the customer chooses a different product description to show up?
Yes, that is correct.
Can you please share your store’s URL?
First you need to create 2 product metafields one that stores the ‘MATTED & FRAMED’ description and another one that stores the 'PRINT ONLY ( NO FRAME) ’ description. Then you need to modify your theme’s code like this
Go to ‘Online Store’ → Themes
From your Active Theme click on the 3 dots (…) → Edit Code
Inside the sections folder locate the file ‘main-product.liquid’
Copy the entire code of the ‘main-product.liquid’ file
Create a new section file called ‘main-product-backup.liquid’
Paste the code you just copied to the new file you created.
In the ‘main-product.liquid’ file scroll down until you find the ‘{% schema %}’ tag.
Above the ‘{% schema %}’ tag paste this code
Before this symbol ‘>’ of the above element add the below data attributes
data-matted-framed-description="{{ product.metafields.custom.matted_and_framed }}"
data-print-only-description="{{ product.metafields.custom.print_only }}"
It should look like this
8.Now you are basically done. The only thing left is to modify the product’s description so that it shows only one description. When someone clicks on a product, the default option is ‘MATTED & FRAMED’, so the description should initially display the ‘MATTED & FRAMED’ description.
Hi @KLDesigns ,
Welcome to Shopify Community.
It requires a bit of coding knowledge to actually achieve this feature.
Are you comfortable with liquid?
Let me know if you need any help.
Thank you,
Sajat
Thank you so much. I will try this out later on today and let you know how it goes.
I am hoping that I created the metafields correct. Am I correct in putting the metafield to the product variant? see photo below.
It is only giving me 100 characters in the metafield description and my descriptions are longer. Thoughts?
Revised Instructions
Metafields Creation
Go to your Shopify Admin → Settings → Custom Data
Click on Products → Add definition
Add name of the metafield such as (MATTED AND FRAMED or PRINT ONLY) and select type of multiline text
Go to your products and fill in the metafields
Code Update
Go to ‘Online Store’ → Themes
From your Active Theme click on the 3 dots (…) → Edit Code
Inside the sections folder locate the file ‘main-product.liquid’
Copy the entire code of the ‘main-product.liquid’ file
Create a new section file called ‘main-product-backup.liquid’
Paste the code you just copied to the new file you created.
In the ‘main-product.liquid’ file scroll down until you find the closing section tag ‘’.
Above the ‘’ tag paste this code
Before the symbol ‘>’ of the above element add the below data attributes
data-matted-framed-description="{{ product.metafields.custom.matted_and_framed }}"
data-print-only-description="{{ product.metafields.custom.print_only }}"
After adding the above data attributes the div element should look like this:
Thank you so much. I will try this later on today ![]()
You are the best! I will try this later on today and let you know how it goes. Thank you.
Hi…that worked…thank you so much however I have a question.
When I click on Print Only the right description comes up and then if I click back on matted and framed the print only description is still there. Do I need to update the code? When I refresh it changes but can it happen if a customer clicks back and forth between the two options. I hope that makes sense.
can you please share the url of the product ?
Can you please share an image of the code you’ve added please? Also the data attributes.
Also how did you name your metafields?
The data attributes look correct. If I may ask did you replace the entire div element that I gave you or did you just include the data attributes?
Can you show me exactly where you added the script code in your main-product.liquid file please?