WC_Order_Data_Store_CPT::set_coupon_held_keys( WC_Order $order, array $held_keys, array $held_keys_for_user )

Add/Update list of meta keys that are currently being used by this order to hold a coupon.


Description Description

This is used to figure out what all meta entries we should delete when order is cancelled/completed.


Parameters Parameters

$order

(Required) Order object.

$held_keys

(Required) Array of coupon_code => meta_key.

$held_keys_for_user

(Required) Array of coupon_code => meta_key for held coupon for user.


Top ↑

Return Return

(mixed)


Top ↑

Source Source

File: includes/data-stores/class-wc-order-data-store-cpt.php

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

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.