Shopify / storefront-api-examples

Example custom storefront applications built on Shopify's Storefront API
https://help.shopify.com/api/storefront-api
MIT License
1.12k stars 329 forks source link

Can't get product title at checkout, Angular app #84

Closed dcharua closed 5 years ago

dcharua commented 5 years ago

Hi, I'm working in the angular storefront, I'm having an issue with the cart, I can't get the product title. {{lineItem.variant.title}} displays: Default title and {{lineItem.variant.product.title}} does not display anything at all.

Anything help will be very appreciated and thank you for the code!

rebeccajfriedman commented 5 years ago

If you create a product without explicitly adding variants to it, it will create a default variant with a title "Default title". I'm not sure how you managed to get a product without a title though.

dcharua commented 5 years ago

Yes you're correct about the variants, but the product title doesn't not display on the line item, this is a bug

rebeccajfriedman commented 5 years ago

@dcharua Open up the developer tools and go to the "Networks" tab. There should be a "graphql" network request that returns a Checkout object. You should be able to see the response that Shopify is returning there. This would be a good place to check if (1) Shopify is not returning a product title or (2) Angular is not properly surfacing the returned product title.

dcharua commented 5 years ago

The problem is that the variant product doesn not have the title property

hasNextPage: false hasPreviousPage: false id: (...) image: (...) nextPageQueryAndPath: ƒ () price: (...) product: GraphModel id: (...) refetchQuery: (...) type: (...)

I ended up adding to title to the lineitem model and pass it when I create the lineitem