Shopify themes, liquid, logos, and UX
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Hi, I am using Woodstock theme.
On a product template, I'm using the promotions card section that pulls a URL from a product metafield to populate the CTA. Not all products have them but this one does.
The metafield URLs are links to files that sit inside Shopify, so not technically an external link I don't think. I'd love these buttons to open in a new tab but I can't figure out how to do that.
Any help would be great! Thanks
Solved! Go to the solution
This is an accepted solution.
This is what it will look like
You are using a paid theme so to tell you the exact file or see it myself i will need access. If it was a free theme by shopify i could have told you the file name. You can check for file names like multi-column.liquid that renders the molticolumn section
This is simple. Just open your code editor and open the file that is rendering the buttons. The button are a tag, inside the a tag just add this attribute target="blank". This will open the file on a new tab
Thanks, I'm not a pro with coding. Do you mind providing a bit more info on where I would find the file with buttons in it? And what the button tag looks like?
This is an accepted solution.
This is what it will look like
You are using a paid theme so to tell you the exact file or see it myself i will need access. If it was a free theme by shopify i could have told you the file name. You can check for file names like multi-column.liquid that renders the molticolumn section
I found the multicolumn.liquid but that code you've copied isn't in there. If I search button, many instances come up but not that specific code.
Try searching with the class name with ctrl + f. Click inside the code editor and press ctrl + f a search bar will appear down below then paste this multicolumn-card__link.
Thank you @Shadab_dev, that helped me when I was trying to achieve the same thing!
Great to hear that. Its interesting how you can reach multiple people from a single post 😊
Hi @Franrulzok
I hope you are well.
When clicking on a link to open it in a new tab, the <a> tag should include the attribute target="_blank", like this: Example screenshot.
For instance, in this case, the <a> tag does not have the target="_blank" attribute: Example screenshot. As a result, clicking the link redirects the user to the current tab instead of opening a new one.
You should find <a> tag and adjust target="_blank"then it will work properly.
Please let me know if it works. Thank you!
Best,
Daisy - Avada Support Team.
So I'm not coding in a URL, otherwise this solution would work. I'm adding a URL to a product metafield and the section on the product page is populated based on the metafield.
Any other ideas on how to acheive this?
Hi @Franrulzok
Could you please share the screenshot of the code you are referring to? And also the meta field setting from your end.
Thank you so much!
Best,
Daisy - Avada Support Team.