mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 13:44:42 +08:00
Do not complete non-checkout button orders via webhooks
This commit is contained in:
parent
40371cbf67
commit
f811ea6a99
2 changed files with 15 additions and 0 deletions
|
@ -258,6 +258,12 @@ class CreateOrderEndpoint implements EndpointInterface {
|
|||
} else {
|
||||
$this->purchase_unit = $this->purchase_unit_factory->from_wc_cart( null, $this->handle_shipping_in_paypal );
|
||||
|
||||
// Do not allow completion by webhooks when started via non-checkout buttons,
|
||||
// it is needed only for some APMs in checkout.
|
||||
if ( in_array( $data['context'], array( 'product', 'cart', 'cart-block' ), true ) ) {
|
||||
$this->purchase_unit->set_custom_id( '' );
|
||||
}
|
||||
|
||||
// The cart does not have any info about payment method, so we must handle free trial here.
|
||||
if ( (
|
||||
in_array( $payment_method, array( CreditCardGateway::ID, CardButtonGateway::ID ), true )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue