Categories
Product Page Shopify Tech

Use all_products in a Shopify Theme

In this liquid Shopify post, we’ll be looking at a way to access product information using all_products. Here’s a quick example:

{{ all_products["product-handle"].id}}

Note

all_products uses product handle as its arguement. While creating the product the handle is created automatically, but if the product title changed the handle is not updated automatically it needs to be changed and do the changes wherever neccessary.

By using all_products one can access any product related property:

all_products["product-handle"].handle
all_products["product-handle"].tags
all_products["product-handle"].template_suffix
all_products["product-handle"].title
all_products["product-handle"].type
all_products["product-handle"].url
all_products["product-handle"].variants
all_products["product-handle"].vendor
all_products["product-handle"].id
all_products["product-handle"].featured_image
all_products["product-handle"].images
all_products["product-handle"].image
all_products["product-handle"].available
all_products["product-handle"].collections
all_products["product-handle"].compare_at_price_max
all_products["product-handle"].compare_at_price_min
all_products["product-handle"].compare_at_price_varies
all_products["product-handle"].content
all_products["product-handle"].description
all_products["product-handle"].first_available_variant
all_products["product-handle"].options
all_products["product-handle"].price
all_products["product-handle"].price_max
all_products["product-handle"].price_min
all_products["product-handle"].price_varies
all_products["product-handle"].selected_variant
all_products["product-handle"].selected_or_first_available_variant

When to use all_products

all_products makes a great option when you have need of outputting a single, or small number of products, that won’t frequently change.

You can explore more by going through this article in detail

Leave a Reply

Your email address will not be published. Required fields are marked *