CustomOrdersTableController::process_pre_update_option()privateWC 1.0

Handler for the setting pre-update hook. We use it to verify that authoritative orders table switch doesn't happen while sync is pending.

{} Это метод класса: CustomOrdersTableController{}

Хуков нет.


null. Ничего.


// private - только в коде основоного (родительского) класса
$result = $this->process_pre_update_option( $option, $old_value, $value );
$option(строка) (обязательный)
Setting name.
$old_value(разное) (обязательный)
Old value of the setting.
$value(разное) (обязательный)
New value of the setting.

Код CustomOrdersTableController::process_pre_update_option() WC 6.6.1

private function process_pre_update_option( $option, $old_value, $value ) {
	if ( self::CUSTOM_ORDERS_TABLE_USAGE_ENABLED_OPTION !== $option || $value === $old_value || false === $old_value ) {
		return $value;

	// TODO: Re-enable the following code once the COT to posts table sync is implemented (it's currently disabled to ease testing).

	$sync_is_pending = 0 !== $this->data_synchronizer->get_current_orders_pending_sync_count();
	if ( $sync_is_pending ) {
		throw new \Exception( "The authoritative table for orders storage can't be changed while there are orders out of sync" );

	return $value;