Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
This is very odd.
I am using metafields to display a variant product on a PDP as a "cross sell":
When I print out the JSON, I can see the object has the property "name":
{
"id": 0123456789344,
"title": "Default Title",
"option1": "Default Title",
"option2": null,
"option3": null,
"sku": "tester-00771",
"requires_shipping": true,
"taxable": false,
"featured_image": null,
"available": true,
"name": "NAME GOES HERE",
"public_title": null,
"options": [
"Default Title"
],
"price": 2500,
"weight": 127,
"compare_at_price": null,
"inventory_management": "shopify",
"barcode": "0123456789",
"requires_selling_plan": false,
"selling_plan_allocations": []
}
However "name" is not accessible on the object, it renders "null":
{% assign cross_sell_product = product.metafields.product.tester_cross_sell.value %}
{{ cross_sell_product.name }}
I've tried all sorts of variations including randomly throwing ".value" around to see if anything works.
Also oddly enough, neither variants nor products objects should have a "name" property per Shopify docs:
https://shopify.dev/docs/api/liquid/objects/product
https://shopify.dev/docs/api/liquid/objects/variant
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024