A customizable, open-source ecommerce platform built on WordPress. Build any commerce solution you can imagine.
Go to file
Tomasz Tunik ee6d1b5ae3 Add to cart button ignored redirect to cart setting (https://github.com/woocommerce/woocommerce-blocks/pull/5708)
* Expose products settings in wcSettings

For the time being we expose only what is used by the blocks
which is `cartRedirectAfterAdd`. In the future more can be added
as needed. Setting is accessible via `getSetting( 'productsSettings' )`.

We namespace the settings under productsSettigns to reflect
the domain and how settings are organised in Woo admin and to
inform that this is an object with more settings within.

This setting normally was available **only** if AJAX add to cart was set
as a js global `wc_add_to_cart_params.cart_redirect_after_add`.
By accessing the option directly we ensure it’s exposed
to blocks regardless of if AJAX option is enabled.

* update AddToCartButton to respect cartRedirectAfterAdd

This adds the redirect directly on the AddToCartButton after succesful
add to cart action. This follows convention that redirects or other side
effects shouldn’t happen as part of the action but rather be part of the
control that triggers such flow.
2022-02-09 09:26:25 +01:00
plugins/woocommerce-blocks Add to cart button ignored redirect to cart setting (https://github.com/woocommerce/woocommerce-blocks/pull/5708) 2022-02-09 09:26:25 +01:00