Show product metafields based on tags

We are a store that sells a large variety of items. I have created a bunch of metafields for attributes for various items, but I don’t want to show all of the metafields on every project page. So far, I have been creating different product templates. So, for art, I have a template that dynamically incorporates metafields for frame width, material, style, etc. For a product like lighting, I have metafields for light type, brightness, etc.

  1. How do I tell shopify to link a product to a certain product template? I can manually add it product by product in the product settings, but don’t see an option to add this as a column in my data file. Can I tell shopify to use a certain product template based on tag instead?

  2. For products like art, some are framed and some are not. Is there a way to conditionally display frame attributes based on if the product has a tag called “framed”? I’m comfortable with coding and am ok with going that route if that is the best option.

What are my options and how would you approach this?

(Site is not live yet, but using the Canopy theme if that helps)

Can you explain this “So, for art, I have a template that dynamically incorporates metafields for frame width, material, style, etc. For a product like lighting, I have metafields for light type, brightness, etc.” in detail and how you implemented this in your product pages. Like how are those metafields implemented in the product pages?. Do you use a specific section to display the metafields(e.g. collapsible row)?

I created a rich text section and added the metafields as dynamic content (connect dynamic source).

Which shows up like this:

And the information changes based on the product like framed, lighting etc right?

correct

Very easy, without product templates. You can achieve this by creating a ‘Metaobject’!!!
Instructions

  1. Go to Online Store → Settings → Custom Data → Create a new Metaobject.

You can create a product metaobject that has all possible product data(id, material,…). For each data you would also have to create the label for it. It should look like this:

  1. Then you can go to ‘Content’->Metaobjects-> Add Entry, and add entries for each product. If a product doesn’t have material or id or something, you can leave it blank. It should look like this:

  1. Then you create a product Metafield and you connect the metaobject to the metafield. T

  2. Then you can go to a product and find the metafield you just created, and select one entry that corresponds to the product.

  3. Finally go to Themes-> Customize , add a rich text section. And dynamically add the label and the data. It should look like this:

Don’t forget to add the ‘:’ symbol in the label and not in the rich text section.

Thanks!

I’m assuming for step 2, I am just inputting dummy data as a placeholder and this will be overwritten per item, correct?

Can you elaborate on steps 3 and 4 please?

What do you mean inputting dummy data as a placeholder?. If a product doesn’t have any of the metaobject’s data types(for example a product doesn’t have dimensions, or an artist, or anything else), you can leave it blank.

For step 3:
In order to use/display the metaobject’s entries(data), you have to create a product metafield that has that metaobject as a type, as shown below:

You select the correct metaobject not just any metaobject…

For step 4:

Once you’ve created the metaobject and its entries, and you filled the entries with data, navigate to ‘Online Store’ → ‘Products.’ Choose the product you want, and in the product metafields section, click on the product metafield you created, and select the entry that matches the data you want to display for that product, as shown below:

If the data entered in step 2 is static data, then this will not work for me as each piece of art has a different artist, size, etc.

You can create multiple entries with different data. That’s how metaobjects work.