什么是:is_paying_customer woocommerce 中的字段 rest api
what is: is_paying_customer field in woocommerce rest api
我正在使用 WooCommerce 休息 api。
当我使用 node.js 和此代码检索用户(客户)时:
WooCommerce.get('customers/25', function(err, data, res) {
console.log(res);
});
我得到一个名为 "is_paying_customer" 的字段;该字段的含义和用法是什么?
用户已经在商店完成了订单
这里是设置这个属性的地方:includes/wc-user-functions.php~280
/**
* Order payment completed - This is a paying customer.
*
* @param int $order_id Order ID.
*/
function wc_paying_customer( $order_id ) {
$order = wc_get_order( $order_id );
$customer_id = $order->get_customer_id();
if ( $customer_id > 0 && 'shop_order_refund' !== $order->get_type() ) {
$customer = new WC_Customer( $customer_id );
if ( ! $customer->get_is_paying_customer() ) {
$customer->set_is_paying_customer( true );
$customer->save();
}
}
}
add_action( 'woocommerce_payment_complete', 'wc_paying_customer' );
add_action( 'woocommerce_order_status_completed', 'wc_paying_customer' );
最后检查add_action函数,当钩子woocommerce_payment_complete或woocommerce_order_status_completed 被调用时,woocommerce 会将 "is_paying_customer" 设置为 TRUE。
我正在使用 WooCommerce 休息 api。 当我使用 node.js 和此代码检索用户(客户)时:
WooCommerce.get('customers/25', function(err, data, res) {
console.log(res);
});
我得到一个名为 "is_paying_customer" 的字段;该字段的含义和用法是什么?
用户已经在商店完成了订单
这里是设置这个属性的地方:includes/wc-user-functions.php~280
/**
* Order payment completed - This is a paying customer.
*
* @param int $order_id Order ID.
*/
function wc_paying_customer( $order_id ) {
$order = wc_get_order( $order_id );
$customer_id = $order->get_customer_id();
if ( $customer_id > 0 && 'shop_order_refund' !== $order->get_type() ) {
$customer = new WC_Customer( $customer_id );
if ( ! $customer->get_is_paying_customer() ) {
$customer->set_is_paying_customer( true );
$customer->save();
}
}
}
add_action( 'woocommerce_payment_complete', 'wc_paying_customer' );
add_action( 'woocommerce_order_status_completed', 'wc_paying_customer' );
最后检查add_action函数,当钩子woocommerce_payment_complete或woocommerce_order_status_completed 被调用时,woocommerce 会将 "is_paying_customer" 设置为 TRUE。