Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableDataStore::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.

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

No Hooks.

Return

Mixed.

Usage

$OrdersTableDataStore = new OrdersTableDataStore();
$OrdersTableDataStore->get_coupon_held_keys_for_users( $order, $coupon_id );
$order(WC_Order) (required)
Order object.
$coupon_id(int)
If passed, will return held key for that coupon.
Default: null

Code of OrdersTableDataStore::get_coupon_held_keys_for_users() WC 7.1.0

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;
}