How to fix the issue where the variant is not finding the product while normalizing cart in framework/spree of V1?

12 Views Asked by At

I'm using commerce v1 with spree as backend. When the user is not logged in and add something to cart using useAddItem hook it's returning error while normalizing cart Couldn't find product for variant with id even though the variant and product are related.Providing related code below

 const product = jsonApi.findSingleRelationshipDocument<ProductAttr>(
    spreeSuccessResponse,
    variant,
    'product'
  )

  if (product === null) {
    throw new MissingLineItemVariantError(
      `Couldn't find product for variant with id ${variant.id}.`
    )
  }

The item is added to cart its just throwing error while normalizing it and that's only for guest user.

0

There are 0 best solutions below