Get product reference from metafields

Shopify Partner
16 0 4

Hi all,

I'm trying to use the new product meta-field to add cross-sell products to my cart.

How can I get the product into the liquid. I have added the below code:

{{ item.product.metafields.product.cross_sell_product_1 }}

 It is returning string like this : gid://shopify/Product/xxxxxxxxxxxxxxx

How I can get the product from this with liquid, So I can show the product name, image, name and varients.


Thank you! 


This is an accepted solution.

You can use code:
{% assign productMetafields = all_products[item.product.metafields.product.cross_sell_product_1] %}
Then you can display it with variable productMetafields.
Hope it helps!

LitExtension - #1 Shopping Cart Migration Expert
If our answer is helpful then please accept as solution!
Are you looking for a solution to migrate to Shopify? Contact us for further assistance.
Try our FREE DEMO now!