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
Shopify Staff
2731 302 783

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
Shopify Staff
2731 302 783

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