Avoid duplicated process for IPN and PDT payment
Currently, Woocommerce is processing twice the payment when IPN and PDT notifications are enable. This mean that stock is reduced twice.
This commit is contained in:
parent
672f45881e
commit
ce4f0edc3a
|
@ -63,9 +63,12 @@ abstract class WC_Gateway_Paypal_Response {
|
|||
* @param string $note Payment note.
|
||||
*/
|
||||
protected function payment_complete( $order, $txn_id = '', $note = '' ) {
|
||||
$order->add_order_note( $note );
|
||||
$order->payment_complete( $txn_id );
|
||||
WC()->cart->empty_cart();
|
||||
if( ! get_post_meta($order->get_id(),"_paypal_payment_completed",true) ) {
|
||||
$order->add_order_note( $note );
|
||||
$order->payment_complete( $txn_id );
|
||||
WC()->cart->empty_cart();
|
||||
update_post_meta($order->get_id(),"_paypal_payment_completed","yes");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue