Hi All,
I am currently working on a theme extension. I have a product ID in the following format: gid://shopify/Product/8789. How can I find this product in Liquid and convert it properly?
Any help would be appreciated!
A developer is working on a Shopify theme extension and needs to find a product using its global ID (GID) format: gid://shopify/Product/8789. They want to know how to locate this product in Liquid and convert it properly.
Response provided:
{{ product.id }}{% for c in collection.products %}
{% assign pId = c.id %}
{{ pId }}
{% endfor %}
Status: The question remains partially answered, as the responder asked for clarification about the specific page context, but the original poster hasn’t confirmed whether these standard methods address their GID conversion need.
Hi All,
I am currently working on a theme extension. I have a product ID in the following format: gid://shopify/Product/8789. How can I find this product in Liquid and convert it properly?
Any help would be appreciated!
On which page you need to find the product ID?
Example:-
On Product Page
You get directly by using {{ product.id }}
On Collection Page
Here you will get by looping through
f{% for c in collection.products %}
{% assign pId = c.id %}
{{ pId }}
{% endfor %}