Metafields on Product Template - Craft Theme

Metafields on Product Template - Craft Theme

CGCO
Not applicable
1 0 0

Hello, 

I'm trying to update my product pages to include more fields. I am familiar with metafields and managed to do what I need in the home and collections templates, but now I'm working on product pages, I'm able to add a block to the template but when I go to choose the correct metafield, it isn't showing up under connect dynamic source. 

I've read a few help articles and it seems like maybe adding a code snippet to the product file is the answer but I tried following a few of them and it didn't work. 

I've got a bunch of metafields working on my live theme but they're all lower down the page. 

I've attached screenshots of what I'm seeing. I'd appreciate any help (I've tried Shopify support but they seem to have given up on providing real support so I'm relying on this community). Thanks!

 

Screenshot 2024-07-05 at 5.43.00 PM.png

Screenshot 2024-07-05 at 5.42.00 PM.png

  

Reply 1 (1)

MaverickStudio
Shopify Partner
11 4 4

Hey @CGCO 

The issue is that the block in the product template only accepts "inline_richtext". The Multi line text metafield is incompatible and hence it won't show up in the dynamic sources.

If you don't need multi line text, then changing the metafield to a Single Line Text would be the easiest solution.

If you absolutely need to use multi line text, you can edit the following file and change the code as described below:
Step 1: Go to Online Store > Theme > Edit code > find  main-product.liquid file
Step 2: Find {% schema %} at the bottom of the file and change the following from this original block to the modified

        {
          "type": "inline_richtext",
          "id": "text",
          "default": "Text block",
          "label": "t:sections.main-product.blocks.text.settings.text.label"
        },

Modified code  for rich text below.

      {
          "type": "richtext",
          "id": "text",
          "default": "<p>Text block</p>",
          "label": "t:sections.main-product.blocks.text.settings.text.label"
        },

Image for referenceScreenshot 2024-07-15 131546.png

If you found my solution helpful, please consider giving it a Like and marking it as the Accepted Solution


Use our WhatsApp Chat Widget Supachat: WhatsApp Chat Button


A Product of Maverick Studio