WordPress at Your Fingertips
function is not described

WC_Order_Data_Store_CPT::set_coupon_held_keys() public WC 1.0

Add/Update list of meta keys that are currently being used by this order to hold a coupon. This is used to figure out what all meta entries we should delete when order is cancelled/completed.

{} It's a 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->set_coupon_held_keys( $order, $held_keys, $held_keys_for_user );
$order(WC_Order) (required)
Order object.
$held_keys(array) (required)
Array of coupon_code => meta_key.
$held_keys_for_user(array) (required)
Array of coupon_code => meta_key for held coupon for user.

Code of WC_Order_Data_Store_CPT::set_coupon_held_keys() WC 5.6.0

public function set_coupon_held_keys( $order, $held_keys, $held_keys_for_user ) {
	if ( is_array( $held_keys ) && 0 < count( $held_keys ) ) {
		$order->update_meta_data( '_coupon_held_keys', $held_keys );
	}
	if ( is_array( $held_keys_for_user ) && 0 < count( $held_keys_for_user ) ) {
		$order->update_meta_data( '_coupon_held_keys_for_users', $held_keys_for_user );
	}
}