Re: Unable to get product reference data using app extension

Solved

Unable to get product reference data using app extension

cyberwombat
Shopify Partner
3 1 1

I have an app extension am working on and added a Product metafields - that of a product ref (custom.upsell). The app extension which I run in dev mode, shows  up correctly in my block editor and all works fine if I use say an integer value but when I choose the metafield to be a product I cannot fetch the data such as the title.

 

According to many posts once could get say the title as:

{% assign upsell = product.metafields.custom.upsell.value %}
{{ upsell.title }}

But that is blank. I have been at this for hours and tried sooooo many variations. I can get the "gid://...' printed and type which is a product_reference. Some posts say to use all_products[...] but thats a no go as well.

 

This problem is seen in other posts that say you need to update the graphQL query to fetch the desired fields but since this is an app extension I am not working with this.

 

I just tried directly in theme same result:

 

  {% assign upsell = product.metafields.custom.upsell.value %}
<h2> {{ upsell.title }}</h2>

Any ideas?

 

 

 

 

Accepted Solution (1)

cyberwombat
Shopify Partner
3 1 1

This is an accepted solution.

Well I had to create a new store. Not totally sure what was up with my dev store - it was old and just added Dawn. I created a new store with demo content and was able to get it to work. Gah.

View solution in original post

Reply 1 (1)

cyberwombat
Shopify Partner
3 1 1

This is an accepted solution.

Well I had to create a new store. Not totally sure what was up with my dev store - it was old and just added Dawn. I created a new store with demo content and was able to get it to work. Gah.