Shopify themes, liquid, logos, and UX
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
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:
<img src="//cdn.shopify.com/s/files/1/0549/4279/3789/files/size-chart_7518321c-ace8-406e-92dd-2ed52b93cbe2.png?v=1637045283" alt="">
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.
THANK YOU!!!!! Seriously, you saved me with this bit of knowledge.
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
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024