How can I display the Product Category field in the Dawn theme?

Hello,

I am new the shopify theme development and have taken the Dawn theme and customised it for my client (who has an existing store with approx 400 products but required a redesign of their online shop). One field they are keen to display on the front-end is the “Product Category” field. This appears underneath “Product Organization” section in shopify just above the Product Type and Vendor fields.

Any documentation I can find on this field seems to refer to it as a field used for categorising products for tax purposes and I don’t see any way of accessing it within the Product object in liquid. I can see other fields such as product.type and product.vendor but no reference to Product Category in any of the developer documentation. (eg. https://shopify.dev/api/liquid/objects/product)

Any help would be appreciated or any links pointing me in the right direction. From reading the forums there seems to be a lot of confusion between, and misuse of, the terms “Collections” and “Product Categories”

Thanks

Ciaran

Hi @ciaranhickey ,

If your customer class defines Category as Collection containing products, you can display it with the following code:

{% for collection in product.collections %}
  {{ collection.title }}
{% endfor %}

If it is not Collection, you need to create a field for customers to enter Category using Metafields and then display it. Refer https://help.shopify.com/en/manual/metafields/metafield-definitions/creating-custom-metafield-definitions

Hope it helps!

Hi Litos,

Thanks for your reply. No it is not collections. We already use collections throughout the site but Product Category is another field in Shopify — it already exists and it is a taxonomy. See: https://help.shopify.com/en/manual/taxes/shopify-tax/product-categories-tax

My client has already entered the category for a lot of products so creating a new meta field would mean starting again.

The Product Category is not a free text field and requires user to select from one of Shopify’s predefined categories/taxonomies as listed here: https://help.shopify.com/txt/product_taxonomy/en.txt

I’ve attached a screen recording of this field in action. Maybe it’s a new field introduced?

I want to know too. No point in having that Product Category Field and we can’t use it in the frontend. I’ve had a look at at the product JSON response for admin and frontend and that value isn’t there. Can someone from Shopify shed some light on this please.

Upvoting this. Same question: wondering if it’s possible in theme Liquid, without apps and GraphQL Admin API.

Hi Ciaranhickey,

Did you find any solution for this?
If not I think I need to create metafield for it.

Can someone from Shopify take a look on how to access the taxonomy through liquid? Or please, tell that it won’t be possible. Or tell when it might become possible.

its been 2 years and you havent answered the question at all?!

Same issue here but with a different intended application. We’re trying to automate our site organization, but without access to product categories in flow, that makes the job significantly harder. We’ve set up products as we were told was best (category for the main, type to be more specific, and then tags for additional info). We have so many products and type is too specific to be able to sort newly added items. The flow would have to be massive in order to check for each type vs narrowing by category then type/tag. Having categories available seems like a no-brainer, so I’m not sure why that’s not the case. It’d be really helpful if someone could explain the why behind omitting that.

Don’t know if anyone is still looking into this issue, but it’s been resolved with a recent update. I can now select product.category.name as a condition.