-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Step 1: Are you in the right place?
- (this is a business logic bug in this codebase)
Step 2: Describe your environment
- Device: Macbook Pro (15-inch, 2018)
- OS version: macOS Mojave (10.14.6)
- Storefront pulled version: master (
c5f7dc3f8f6416392b58b1058953d60f38e24b11
) - Node version: reproduced using both Node v10.16.0 and v12.19.0
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:
- The product title
- The SKU code display
- Any additional attributes that may be displayed (more of an issue for customized versions of the storefront)
Steps to reproduce:
- Load a multivariant page where the price for the parent and child products are different
- Change one of the SKU options
- Click add-to-cart
- Open the cart
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 into VariationsSelector
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.