Writed this query for get metafield from payment customization function
query RunInput ($selectedCollectionIds: [ID!]) {
cart {
cost {
totalAmount {
amount
}
}
lines {
merchandise {
__typename
…on ProductVariant {
id
product {
id
handle
metafield(namespace: “payment-customization”,
key: “function-configuration”) {
value
}
hasTags(tags: ) {
tag
}
inAnyCollection(ids: $selectedCollectionIds)
}
}
}
}
}
paymentMethods {
id
name
}
paymentCustomization {
metafield(namespace: “payment-customization”, key: “function-configuration”) {
value
}
}
}
In Toml file write input variable this its working fine in app extension and also gives metafield but not working in frontend side.
[input.variables]
namespace = “payment-customization”
key = “function-configuration”
So, I corrected it by adding extensions before input.variable
[extensions.input.variables]
namespace = “payment-customization”
key = “function-configuration”
now its not working its giving metafiled null.
Please help me to solve this issue.
Thank you
I will carefully review the code according to your suggestion. Before that, could you please help me confirm one thing? I learned in the tutorial documentation(https://shopify.dev/docs/apps/functions/input-output/variables-queries) that Input query variables value can be set using the metafield collection on the create or update mutation on your function owner.
I am not getting how my metafield value is exceed limit if I only gives 3 values in it,
{
“selectedCollectionIds”: [
“gid://shopify/Collection/1”,
“gid://shopify/Collection/2”,
“gid://shopify/Collection/3”
]
}
It sounds like you are setting the metafield on the wrong object. To use variables with a payment customization function, the metafield should be set on the payment customization itself. It appears you are already using that metafield for some function configuration. You can either add to that metafield, or specify a different one for your variables.
I have tried with this also still its giving null, defined metafield in admin product why it’s giving null in payment-customization.
Is there any other approach to get metafield from the product.