Only set paying customer prop when required

This commit is contained in:
Beka Rice 2019-07-10 18:36:43 -04:00
parent 0e1a926721
commit 3c2e3cc9aa
1 changed files with 5 additions and 2 deletions

View File

@ -247,8 +247,11 @@ function wc_paying_customer( $order_id ) {
if ( $customer_id > 0 && 'shop_order_refund' !== $order->get_type() ) {
$customer = new WC_Customer( $customer_id );
$customer->set_is_paying_customer( true );
$customer->save();
if ( ! $customer->get_is_paying_customer() ) {
$customer->set_is_paying_customer( true );
$customer->save();
}
}
}
add_action( 'woocommerce_payment_complete', 'wc_paying_customer' );