Fix wc_paying_customer() refund check
wc_paying_customer() needs to check against 'shop_order_refund', which is the actual return value of WC_Order_Refund::get_type(). No object will return 'refund', so a customer would always be declared as a paying customer even for refund orders.
This commit is contained in:
parent
9d513737ed
commit
3f338cd3e1
|
@ -179,7 +179,7 @@ function wc_paying_customer( $order_id ) {
|
||||||
$order = wc_get_order( $order_id );
|
$order = wc_get_order( $order_id );
|
||||||
$customer_id = $order->get_customer_id();
|
$customer_id = $order->get_customer_id();
|
||||||
|
|
||||||
if ( $customer_id > 0 && 'refund' !== $order->get_type() ) {
|
if ( $customer_id > 0 && 'shop_order_refund' !== $order->get_type() ) {
|
||||||
$customer = new WC_Customer( $customer_id );
|
$customer = new WC_Customer( $customer_id );
|
||||||
$customer->set_is_paying_customer( true );
|
$customer->set_is_paying_customer( true );
|
||||||
$customer->save();
|
$customer->save();
|
||||||
|
|
Loading…
Reference in New Issue