FROM CACHE - en_header

Accessing custom product types within the product object

quixote
Shopify Partner
3 0 2

Good day to you, fellow Shopify enthusiasts!

My question, is exactly what the title suggests: Is it possible to access custom product type from the product object?

{% assign customType = product.custom_type %} This would assign the custom type as a string.

I would like to conditionally render an information section on the product page.

If I can't accomplish it this way I can always add the necessary tags to my products. I am just curious if this functionality exists.

Cheers!  

Replies 2 (2)
mlubina
New Member
1 0 0

Hi, 

I have just tested. A custom product type is created when the value entered in the product_type attribute doesn't exist in the standard product_types. 

You can therefore just enter the wanted custom product type in the product_type field.

 

Hope this helps. 

 

Kind regards,

 

mlubina

RachelHSS
Tourist
10 0 2

Hello,

 

Non-coder with a very basic knowledge trying to make some minor tweaks to our theme to make it work better for us. 

 

I have the same question as @mlubina, except my problem is that most of our products have both standard and custom types assigned. I work for a jewelry designer and the problem I'm running into is that I'm trying to conditionally display different tabs on our product pages for rings and bands. In standard product type, there is no option for "bands" so we have the bands and rings all under "rings" as the standard type. So using the product.type reference, it displays the rings content on the band pages as well.

 

I'm just wondering if there's any way to reference the custom type specifically (excluding/regardless of the standard type) - or if there are any other suggestions that would prevent me having to go back through all of the existing bands and remove the standard types.

 

Thanks in advance for any advice!