Where should I create a Metafield that should be use with the same text in different parts?

Where should I create a Metafield that should be use with the same text in different parts?

ROS4
Tourist
12 1 1

Hi everyone!

 

I want to create some general metafields in my shop, but I don't know where should I locate them.

I will explain it with one example. In my product page template, there are some parts that are commons for different products or type of products. Nowadays, I have to copy and paste the same text in all the products. If I decide to change this text, I have to change one by one. I want to allocate this text only in one place to avoid future error and problems- And also optimize my work, obviously...

Replies 2 (2)

Shadab_dev
Shopify Partner
613 39 68

Well as you already know that you have to use metafields for this. 

 

You can find metafields under settings and custom data from backend or admin of your store. For your needs you need to create product metafields and since you want to add text you can use a multi line text field. 

 

Once you create this product metafield you will find this metafield in each product where you can enter values. You do have to go in every product to do this but this way it's a lot simpler. 

 

Now the main thing is to render this value. What you can do is add a text block and dynamically connect it with the metafield. Note: you have to add a text block to connect text. 

 

One other way is to open your customizer and drag a custom liquid block and add this code 

 

{{product.metafields.custom-value}}

 

In place of custom value add the name of your metafield. So if you named it text aad text in place of custom value.

 

Please reach out via mail for a convenient conversation and solution in case you need any help.

 

Thanks

Shadab

Buy me Coffee, if you feel i was helpful. Email Me or WhatsApp me for any help with shopify theme customizations or any project in web dev. If this is helpful, please Like and Accept the solution.

PaulNewton
Shopify Partner
7450 656 1561

Set defaults for some metafield types when creating the metafield definition

Or make market metafields and set those as dynamic sources in tempaltes.

Or use metaobjects entries as references and through those are what are set to some products as metafields.

Contact [email protected] for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org