Open plundaahl-ep opened 3 years ago
Just a quick note: I believe that this is at least partially-related to this issue. As I mentioned in my comment on that issue, I believe the problem is really one of separating out the domain model.
I believe that an accurate domain model for the Product
component would include:
product.meta.variations
and product.meta.variation_matrix
from the parent product (as returned from the API)When the user changes the SKU configuraiton in the VariationsSelector
, I don't think it should just be updating the product ID - I think it should be fetching the entire product.
Thanks!
Bug created: https://elasticpath.atlassian.net/browse/MT-6134 However, the price in the cart actually reflects the right one been added.
This is fixed now in ticket https://elasticpath.atlassian.net/browse/MT-6134. @yasiloghmani please update when the code merged
Step 1: Are you in the right place?
Step 2: Describe your environment
c5f7dc3f8f6416392b58b1058953d60f38e24b11
)Step 3: Describe the problem:
This bug occurs on the product page for multi-variant products.
When the user changes the variant configuration for a multi-variant product, none of the page details (aside from the variation options) are updated. This can be most clearly seen when the prices for child products are different to that of the parent. In this case, when the user adds the product to the cart, the line item in the cart will have a different price to that advertised on the product page.
However, this also affects:
Steps to reproduce:
Observed Results:
Notice that the price for the added item and the price on the product page do not match.
Expected Results:
Assuming there are no coupons or promotions applied, the price of the line-item in the cart should match that of the item on the product page.
Relevant Code:
The relevant code is in product.tsx. Note that the
handleVariationChange
function, which is passed intoVariationsSelector
on line 231, is simply updating the product ID (line 108).For the expected behavior to occur, we would need to load the child product from the API when the user updates the SKU options.