I have a Rich Text Metafield setup for products to display product specifications.
I am using the below to display this Metafield - Although if I add a newline “Shift + Enter” it doesn’t display this in the frontend, it just keeps the text as one line. Can anyone let me know why I cant seem to get line breaks to work when displaying the Metafield?
would you care to explain me where I can find this line in code and change it to your definition.
I’d like to make some line breaks in the metafield’s rich text.
To add the code snippet for the metafield in your Shopify theme, you’ll need to edit the theme’s Liquid files. Here’s a step-by-step process to add the code in the right place:
Log in to your Shopify admin.
Go to Online Store > Themes.
Find the theme you want to edit and click on the Actions dropdown menu, then select Edit code.
To display the metafield on the product page, search for the file product-template.liquid or product.liquid in the Sections folder. Alternatively, you may find a similar file name in the Templates folder (like product.liquid or product-custom.liquid).
Once you’ve opened the appropriate file, look for an appropriate section of the code where you’d like to display the metafield. You might want to place it near other product information, like the product description or product specifications.
Insert this code snippet in the desired location within the file:
{%- if product.metafields.custom.product_specifications != blank -%}
Save the file by clicking the ‘Save’ button in the top right corner.
Now, when a product has a value for the specified metafield, it will be displayed on the product page. Remember to replace custom and product_specifications with the appropriate namespace and key for your metafield.
Problem is that I can’t find any of the mentioned file to add the code.
To display the metafield on the product page, search for the file product-template.liquid or product.liquid in the Sections folder. Alternatively, you may find a similar file name in the Templates folder (like product.liquid or product-custom.liquid).
I understand that I should place the code in the ‘Edit code’.
Shopify specifies:
To display the metafield on the product page, search for the file product-template.liquid or product.liquid in the Sections folder. Alternatively, you may find a similar file name in the Templates folder (like product.liquid or product-custom.liquid).
I’m trying the Prestige theme 7.0 (upgraded) and can’t find any of those files. There are no mentioned files in Section or Templates folder.