Shopify/storefront-api-examples

Can't get product title at checkout, Angular app

dcharua opened this issue · 4 comments

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!

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.

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

@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.

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