Fix: Wait for the product to be added to cart before redirecting customer to the cart page (https://github.com/woocommerce/woocommerce-blocks/pull/6466)

This commit is contained in:
Tung Du 2022-05-27 13:36:49 +07:00 committed by GitHub
parent 4976afad58
commit 0b51900bd2
1 changed files with 2 additions and 2 deletions

View File

@ -142,8 +142,8 @@ const AddToCartButton = ( {
} );
};
} else {
buttonProps.onClick = () => {
addToCart();
buttonProps.onClick = async () => {
await addToCart();
dispatchStoreEvent( 'cart-add-item', {
product,
} );