Closed chickenn00dle closed 3 years ago
I think it should be.
add_action( 'woocommerce_pay_order_after_submit', array( $this, 'maybe_ensure_session' ) );
The other part of the file is also using ensure_session
when it should be maybe_ensure_session()
Issue: #842
Description
This adds the ensure_session callback to an order-pay hook when Single Product Checkout is disabled.
Previously, in cases where a guest checks out via the order-pay page (via a payment link sent from the merchant), and Single Product Checkout is not enabled, no session is set and so the method responsible for processing once we return from PayPal returned early, and guests ended up at an empty cart page (See https://github.com/woocommerce/woocommerce-gateway-paypal-express-checkout/issues/842#issuecomment-759990913 for details).
This PR fixes that by adding the ensure_session cb to a hook specific to the order-pay page. We avoid adding this when Single Product Checkout is enabled as this cb is already added to a more generic hook in this case.
Steps to test:
trunk
, you will be redirected to an empty cart page. On this branch, the payment will be successful.Documentation
Changelog entry
Closes #842