Solved

Adding custom field to one product

plants4friendz
Excursionist
21 0 7

Can someone assist me? I'm trying to add this custom field to only my Custom Essence product.


I've tried to follow other instructions, but I think I'm doing something wrong.


I've added custom liquid code to the product which shows up fine, it just shows on all products:

 

Screenshot 2023-11-27 at 9.44.02 AM.png

 

I've attempted to create a metafield:

 

Screenshot 2023-11-27 at 9.44.43 AM.png

 

Then I added this code to main-product-liquid, but it created an additional box in the wrong place:

 

{%- if product.metafields.custom.enable_product_personalization.value -%}

<label for="message" class="form__label">Want to add additional flowers?</label>

<div class="field">

  <textarea id="message" class="text-area field__input" placeholder="Message" name="properties[Message]"form="product-form-{{ section.id }}"></textarea>

</div>

            {%- endif -%}

 

I've also tried to connect a dynamic source to the liquid code on the product, but the metafield is not found.

Am I trying to do too many different things or maybe just adding the code to the wrong place?

 

Please advise! Thank you.

 

Accepted Solution (1)

fadi_yousif
Shopify Partner
342 43 60

This is an accepted solution.

Metafields can be confusing to deal with if you're not a developer. An easier option would be to create a separate product template that contains the custom field and assign it to the Custom Essence product. I can send a collaborator request if you want me to do it for you.

Freelance Shopify Developer | Helping Shopify merchants grow with high-converting online stores!
Let's work together!
 - Did I help? Leave a tip!
 - Need my help? Chat on Telegram or WhatsApp

View solution in original post

Replies 3 (3)

fadi_yousif
Shopify Partner
342 43 60

This is an accepted solution.

Metafields can be confusing to deal with if you're not a developer. An easier option would be to create a separate product template that contains the custom field and assign it to the Custom Essence product. I can send a collaborator request if you want me to do it for you.

Freelance Shopify Developer | Helping Shopify merchants grow with high-converting online stores!
Let's work together!
 - Did I help? Leave a tip!
 - Need my help? Chat on Telegram or WhatsApp

plants4friendz
Excursionist
21 0 7

That's very helpful thank you! I'm new to Shopify and didn't realize I could do that. 

fadi_yousif
Shopify Partner
342 43 60

Glad it helped!

Freelance Shopify Developer | Helping Shopify merchants grow with high-converting online stores!
Let's work together!
 - Did I help? Leave a tip!
 - Need my help? Chat on Telegram or WhatsApp