How to create an accordion on the product page where I can insert an image?
Example:
Url: https://flaud.world/
Password: 202135283
Thanks,
B
A user seeks to add images inside product page accordion/collapsible tabs on Shopifyâs Dawn theme. The solution involves using Dawnâs built-in âCollapsible Tabâ block combined with product metafields.
Implementation steps:
{{ product.metafields.namespace | img_tag }} in the collapsible tab contentFollow-up issues resolved:
style="width:50%")Additional context:
How to create an accordion on the product page where I can insert an image?
Example:
Url: https://flaud.world/
Password: 202135283
Thanks,
B
@bhristopher - free accordion code here , you can use it and put image instead of text
@suyash1 - Canât seem to figure out why it isnât dropping down. Could you take a look?
Thanks,
B
Hello @bhristopher ,
Hope you are doing well!
In Shopify 2.0 themes like Dawn, you can achieve this using the âCollapsible Tabâ block. Then you can insert images (by selecting dynamic data source) using Shopify metafields.
@SagarikaDas - Thank you for that! How exactly do I add the image using metafields?
Hello @bhristopher ,
This Shopify guide will help you in creating metafields in your dawn theme: https://help.shopify.com/en/manual/metafields
First, we need to change the type of the Collapsible tabs that is by default âRich textâ. Go to Online Store > Edit Code and open main-product.liquid file. Change the type to âliquidâ for the content of the Collapsible tab.
Save the changes!
Now, for adding images using metafield:
{{ product.metafields.my_fields.namespace | img_tag }}
You can see the image in your Collapsible tab!
It worked! Thank you so much.
Now iâm running into a problem with the size of the image in the collapsible tab. The image in the tab is the same px width as the dropdown menu and âadd to cartâ button.
Are you able to take a look at the code and tell me where I need to make the adjustment?
Url: https://flaud.world/products/copy-of-copy-of-copy-of-copy-of-sweatsuit-pullover
Password: 202135283
Thanks,
B
Hello @bhristopher ,
I found a solution! Kindly replace the Collapsible tab content with the below code:
Cheers!!
@SagarikaDas - Iâm trying to add a different image in the collapsible tab for a specific product, but itâs changing for all of the other products. How do I fix this?
Thanks,
B
Dear @bhristopher ,
As you are working on the default product template for all the products, it will happen!
You either need to use metafields for dynamic data product-wise (that only shows small-size images) or you can create different product page templates for specific products.
@SagarikaDas Got it, I will try to create a different product theme template.
While I have you here, iâm looking to align the title and price on one line. The title being on the left side, and the price being on the right side. Are you able to take a look and come up with a fix for this?
@SagarikaDas How do I create the exact same template? Iâm unsure of what file/asset I need to copy and paste from.
Hello @bhristopher ,
I think this guide will help you to resolve your issue: How To Create Custom Product Template in Shopify 2.0 Themes
AMAZING!!! Thank you, this worked perfect.
Hi @SagarikaDas ,
But how do you make those collapsible tabs closed when another one is open? And how do you make the first one open as default?
Cheers
THANK YOU!!! Seriously, you saved me with this bit of knowledge.
Hi, Iâm also trying to create an accordion/collapsible row but in Ritual theme. Iâm unable to find main-product.liquid. I can see something about _accordion-row.liquid but there is no ârichtextâ I can see like in the Dawn theme. Hoping you can help. Thanks in advance.
Use Metafield as an File and Call it in the product page where you want.
Hey @Johnny999,
Could you please share your store url and password [if applicable] so that I can take a look and provide you with the solution code.
Waiting to hear back from you.
Thanks
Thanks for sharing the store url @Johnny999,
I just check your site and found that in order to add the image near the collapsible row requires to do the custom code in your theme.
Could you please share the 4 digits collab code in the p/m so that I can do it for you.
Waiting to hear back from you.
Thanks