Adjusts the utility to retrieve a product by its ID to prioritise the product data object over the cart object. This is to prevent the existing cart quantity from being sent with an add_to_cart event.
Additionally, the function to format product data is updated to pass along the quantity on the added_to_cart event.
Detailed test instructions:
Checkout fix/391-incorrect-product-quantity and build the extension
Go to the shop archive
Add a simple product to the cart multiple times
Refresh the page
Add the same product to the cart and confirm that the event sent has the correct quantity of 1
Go to the single product page
Set the quantity 4 and add it to cart
Confirm the quantity sent in the event is 4
Changelog entry
Fix - Incorrect quantity value when adding product to the cart that exists in the cart
Changes proposed in this Pull Request:
Closes #391
Adjusts the utility to retrieve a product by its ID to prioritise the product data object over the cart object. This is to prevent the existing cart quantity from being sent with an
add_to_cart
event.Additionally, the function to format product data is updated to pass along the quantity on the
added_to_cart
event.Detailed test instructions:
fix/391-incorrect-product-quantity
and build the extension1
4
and add it to cart4
Changelog entry