wc_release_coupons_for_order()WC 9.5.2

Release coupons used for another order.

Хуков нет.

Возвращает

null. Ничего (null).

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

wc_release_coupons_for_order( $order, $save );
$order(\WC_Order|int) (обязательный)
Order ID or instance.
$save(true|false)
Save the order after releasing coupons.
По умолчанию: true

Список изменений

С версии 9.5.2 Введена.

Код wc_release_coupons_for_order() WC 9.6.1

function wc_release_coupons_for_order( $order, bool $save = true ) {
	$order = $order instanceof WC_Order ? $order : wc_get_order( $order );

	if ( $order ) {
		$order->get_data_store()->release_held_coupons( $order, $save );
	}
}