WC_Order_Data_Store_CPT::get_coupon_held_keys_for_users()publicWC 1.0

Return array of coupon_code => meta_key for coupon which have usage limit per customer and have tentative keys.

Метод класса: WC_Order_Data_Store_CPT{}

Хуков нет.

Возвращает

Разное.

Использование

$WC_Order_Data_Store_CPT = new WC_Order_Data_Store_CPT();
$WC_Order_Data_Store_CPT->get_coupon_held_keys_for_users( $order, $coupon_id );
$order(WC_Order) (обязательный)
Order object.
$coupon_id(int)
If passed, will return held key for that coupon.
По умолчанию: null

Код WC_Order_Data_Store_CPT::get_coupon_held_keys_for_users() WC 9.4.2

public function get_coupon_held_keys_for_users( $order, $coupon_id = null ) {
	$held_keys_for_user = $order->get_meta( '_coupon_held_keys_for_users' );
	if ( $coupon_id ) {
		return isset( $held_keys_for_user[ $coupon_id ] ) ? $held_keys_for_user[ $coupon_id ] : null;
	}
	return $held_keys_for_user;
}