mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
Do not call get PayPal order if order id is empty
This commit is contained in:
parent
e5cced2008
commit
fda789228c
1 changed files with 6 additions and 1 deletions
|
@ -162,6 +162,11 @@ class OrderProcessor {
|
||||||
*/
|
*/
|
||||||
public function process( \WC_Order $wc_order ): bool {
|
public function process( \WC_Order $wc_order ): bool {
|
||||||
$order_id = $wc_order->get_meta( PayPalGateway::ORDER_ID_META_KEY );
|
$order_id = $wc_order->get_meta( PayPalGateway::ORDER_ID_META_KEY );
|
||||||
|
if ( ! $order_id ) {
|
||||||
|
$this->last_error = __( 'No PayPal order ID found in the current WooCommerce session.', 'woocommerce-paypal-payments' );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$order = $this->session_handler->order() ?? $this->order_endpoint->order( $order_id );
|
$order = $this->session_handler->order() ?? $this->order_endpoint->order( $order_id );
|
||||||
if ( ! $order ) {
|
if ( ! $order ) {
|
||||||
$this->last_error = __( 'No PayPal order found in the current WooCommerce session.', 'woocommerce-paypal-payments' );
|
$this->last_error = __( 'No PayPal order found in the current WooCommerce session.', 'woocommerce-paypal-payments' );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue