Hello. I’m working on the post purchase extensions for shopify, and I need to access the product level metafield (metafield type = variant) from my extension, for some reason the array of metafields inside const inputData = useExtensionInput(); is empty.
Here’s the output of inputData from the post purchase extension
{
“locale”: “en-US”,
“inputData”: {
“token”: “...”,
“shop”: {
“id”: 71985168561,
“domain”: “...”,
“metafields”:
},
“initialPurchase”: {
“referenceId”: “e1f6e34de4677085d0db57eae3917ffd”,
“customerId”: 8524178882737,
“destinationCountryCode”: “US”,
“totalPriceSet”: {
“shopMoney”: {
“amount”: “949.95”,
“currencyCode”: “USD”
},
“presentmentMoney”: {
“amount”: “949.95”,
“currencyCode”: “USD”
}
},
“lineItems”: [
{
“totalPriceSet”: {
“shopMoney”: {
“amount”: “949.95”,
“currencyCode”: “USD”
},
“presentmentMoney”: {
“amount”: “949.95”,
“currencyCode”: “USD”
}
},
“quantity”: 1,
“product”: {
“id”: 8823256121521,
“title”: “_The Inventory Not Tracked Snowboard”,
“variant”: {
“id”: 46271071617201,
“title”: “Default Title”,
“metafields”: <--------------------- ???
},
“metafields”:
},
“sellingPlanId”: null
}
]
},
“locale”: “en-US”,
“extensionPoint”: “Checkout::PostPurchase::Render”,
“version”: “unstable”
},
“extensionPoint”: “Checkout::PostPurchase::Render”,
“version”: “unstable”,
“storage”: {
“initialData”: {
“initialState”: {
“couldBe”: “anything”
}
}
}
}
Here’s my metafields definition from shopify.extension.toml file:
[[metafields]]
namespace = “custom”
key = “suggested_product”
resource = “product”
Questions:
Does your product have this metafield? => Yes
Does your metafield have storefront api access? => Yes
Did you redeploy the app when you changed the shopify.extension.toml? => Yes