In 2.0 we changed the behaviour so that when a customer closes/cancels the PayPal modal they're now always redirected to the cart page.
There are a few instances where this change feels a bit odd from a customer's perspective. Some examples:
you have filled in the checkout address forms, selected shipping, click the PayPal button, decide you wanted to pay with Stripe, close the PayPal window and are redirected to the cart page.
you are browsing a product page and click the PayPal button, decide you don't want to go ahead with the order, close the window and get redirected to the cart page.
This also feels a bit weird if your store doesn't use a cart page (i.e. empty Cart page in WooCommerce > Settings > Advanced) and customers are redirected back to stores home page.
Looking at 1.6.21, when you closed/cancelled the PayPal modal, you would land back the same page which feels a bit more natural.
In this PR, I'm passing an empty cancel_url and have updated the onCancel handler so that we will now only redirect the customer to a cancel_url if it's set using the woocommerce_paypal_express_checkout_payment_button_data filter.
The default behaviour will now return the customer back to the same page they clicked on the PayPal Buttons (as per in 1.6.21 and previous versions)
Steps to test:
Visit a product page
Click on the PayPal button
Close the pop-up window
On master, redirected to the cart page
On this branch, redirected back to the product page.
Documentation
[ ] This PR needs documentation (has the "Documentation" label).
Issue: #757
Description
In 2.0 we changed the behaviour so that when a customer closes/cancels the PayPal modal they're now always redirected to the cart page.
There are a few instances where this change feels a bit odd from a customer's perspective. Some examples:
This also feels a bit weird if your store doesn't use a cart page (i.e. empty Cart page in WooCommerce > Settings > Advanced) and customers are redirected back to stores home page.
Looking at 1.6.21, when you closed/cancelled the PayPal modal, you would land back the same page which feels a bit more natural.
In this PR, I'm passing an empty
cancel_url
and have updated theonCancel
handler so that we will now only redirect the customer to acancel_url
if it's set using thewoocommerce_paypal_express_checkout_payment_button_data
filter.The default behaviour will now return the customer back to the same page they clicked on the PayPal Buttons (as per in 1.6.21 and previous versions)
Steps to test:
master
, redirected to the cart pageDocumentation
Closes #757 .