Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Adding a new metafield of type "product_reference" not working

Adding a new metafield of type "product_reference" not working

Jomei
Shopify Partner
2 0 0

Hey all, I'm trying to write an app and I'm having some trouble making a new metafield of type "product_reference" through js. It works when the metafield type is "single_line_text_field", but for some reason once I try passing in a product reference, it doesn't work. I've attached a screenshot of the relevant code, if that would help. Otherwise, if any of you have any experience with this issue, any help would be appreciated? Thanks. 

 

Screenshot 2023-06-22 at 3.46.39 PM.png

Replies 3 (3)

Liam
Community Manager
3108 344 894

Hi Jomei,

 

Thanks for flagging this issue - I'll connect with the custom content team and see if there's an issue on our side which would explain this problem. I'll update here when I hear back. 

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

Jomei
Shopify Partner
2 0 0

Thanks, I'm not sure how, but I got it to work. At least for this case, I believe I figured out my issue. 

Liam
Community Manager
3108 344 894

Great to hear it's working! And there should not be any difference in creating a "single_line_text_field" metafield vs a "product_reference" metafield.

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