WC_Order_Data_Store_CPT::get_coupon_held_keys_for_users()
Return array of coupon_code => meta_key for coupon which have usage limit per customer and have tentative keys.
Method of the class: WC_Order_Data_Store_CPT{}
No Hooks.
Return
Mixed
.
Usage
$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) (required)
- Order object.
- $coupon_id(int)
- If passed, will return held key for that coupon.
Default: null
WC_Order_Data_Store_CPT::get_coupon_held_keys_for_users() WC Order Data Store CPT::get coupon held keys for users code 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; }