I want to add clickable words in the metafields to relate these words to products.
I can do this in two ways, but I’m not succeeding in either.
1 - Create a text metafield and be able to add links to the words in the metafields of each product.
2 - Create a product metafield and edit how it appears in the theme. In this case, I need help removing the “add to cart” button because my products are customizable, and if the customer adds to the cart through this button, they will receive the wrong product.
Below is a screenshot of exactly how I want the metafield to appear.
I want to relate products in this way, using clickable text.
Can someone help me with this question? I’m not very familiar with coding.
I want to showcase related products on the product page. However, I don’t want the product image or the add to cart button. I want it in plain text, formatted, and with a link.
I’ll send the link of the website where I saw this, maybe it will help (not sure if I can share links here like this).
Don’t worry. this will not display the products on your product page. It required some liquid coding. If you want to display only the text and a product link, you can do it now. If you know some liquid coding I can provide you the code then you can put the code in your product page code. or you can give me access to your store to help you.
create a file in your snippets folder. Set the name of its others-products.liquid
Paste the code below in that file.
{% assign others = product.metafields.namespace.key %}
Other versions:
{% for item in others.value -%}
{{ item.title | upcase }}
{% unless forloop.last %}
|
{% endunless %}
{%- endfor %}
Keep in mind that it will not work because the actual metafield definition is missing. Create the metafield and modify the code. replace “namespace” and “key” with your metafield definition.