Discussing Shopify Functions development, deployment, and usage in Shopify apps.
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
Hi Rishika_286,
There's a couple of things you can try to troubleshoot this issue:
selectedCollectionIds
variable to the query if it’s needed.Try the above and let us know if you're still seeing issues. Hope this helps!
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
You posted this to another thread:
Your issue is unrelated to input query variables. The metafield on the product is either null, or its value exceeds the limit of 10KB.
Nick Wesselman | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
First of all - thanks for the answer!
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.
Nick Wesselman | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
Created different metafield in product for same but still its giving null value , can you please explain where I am doing wrong,
Don't put the metafield on the product. Put it on the payment customization.
Nick Wesselman | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
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.