Merge pull request #24249 from miguelfspinto/patch-2

Avoid duplicated process for IPN and PDT payment
This commit is contained in:
Rodrigo Primo 2019-09-24 17:59:56 -03:00 committed by GitHub
commit b63ecca450
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -63,9 +63,11 @@ 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 ( ! $order->has_status( array( 'processing', 'completed' ) ) ) {
$order->add_order_note( $note );
$order->payment_complete( $txn_id );
WC()->cart->empty_cart();
}
}
/**