mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
do not process order from block pages
This commit is contained in:
parent
eaf7985145
commit
21bc7be648
2 changed files with 3 additions and 1 deletions
|
@ -10,6 +10,7 @@ const onApprove = (context, errorHandler) => {
|
||||||
nonce: context.config.ajax.approve_order.nonce,
|
nonce: context.config.ajax.approve_order.nonce,
|
||||||
order_id:data.orderID,
|
order_id:data.orderID,
|
||||||
funding_source: window.ppcpFundingSource,
|
funding_source: window.ppcpFundingSource,
|
||||||
|
should_create_wc_order: true
|
||||||
})
|
})
|
||||||
}).then((res)=>{
|
}).then((res)=>{
|
||||||
return res.json();
|
return res.json();
|
||||||
|
|
|
@ -236,7 +236,8 @@ class ApproveOrderEndpoint implements EndpointInterface {
|
||||||
|
|
||||||
$this->session_handler->replace_order( $order );
|
$this->session_handler->replace_order( $order );
|
||||||
|
|
||||||
if ( ! $this->final_review_enabled && ! $this->is_checkout() ) {
|
$should_create_wc_order = $data['should_create_wc_order'] ?? false;
|
||||||
|
if ( ! $this->final_review_enabled && ! $this->is_checkout() && $should_create_wc_order ) {
|
||||||
$wc_order = $this->wc_order_creator->create_from_paypal_order( $order, WC()->cart );
|
$wc_order = $this->wc_order_creator->create_from_paypal_order( $order, WC()->cart );
|
||||||
$this->gateway->process_payment( $wc_order->get_id() );
|
$this->gateway->process_payment( $wc_order->get_id() );
|
||||||
$order_received_url = $wc_order->get_checkout_order_received_url();
|
$order_received_url = $wc_order->get_checkout_order_received_url();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue