-
Notifications
You must be signed in to change notification settings - Fork 220
Single Product block: Redirect to the cart page after successful addition setting isn't respected #11151
Single Product block: Redirect to the cart page after successful addition setting isn't respected #11151
Conversation
The release ZIP for this PR is accessible via:
Script Dependencies ReportThere is no changed script dependency between this branch and trunk. This comment was automatically generated by the TypeScript Errors Report
🎉 🎉 This PR does not introduce new TS errors. |
Size Change: 0 B Total Size: 1.48 MB ℹ️ View Unchanged
|
@thealexandrelara |
Hey @Marc-pi, I can consistently reproduce this issue, however, it only occurs when the "Add to Cart With Options" block is inside the "Single Product" block. This happens because the default behavior when clicking the "Add to Cart" button is to redirect to the product page. However, since the "Single Product" block can be added to any page, we prevent the redirection from occurring. Unfortunately, we hadn't anticipated the case in which the shopper should be redirected to the cart if the setting is enabled in WooCommerce Settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! LGTM!
Bumping PR to next release. |
…en-option-is-set-to-true
Changed to include in 11.3.0 release. |
What
The Single Product block does not respect the setting under WooCommerce > Settings > Products > General > Add to cart behaviour > Check - Redirect to the cart page after successful addition.
Fixes #10775
Why
This PR solves that by checking if the "Redirect to the cart page after successful addition" option was set in the WooCommerce Settings. If that is the case, then we allow the user to be redirected to the cart page after adding the product to the cart.
Testing Instructions
Please consider any edge cases this change may have, and also other areas of the product this may impact.
Test 1: Redirect shopper to the cart page after successful addition when setting is enabled
Test 2: Keep shopper at the same page when setting is disabled
WooCommerce Visibility
Required:
Changelog