WC_Checkout::__set()publicWC 1.0

Sets the legacy public variables for backwards compatibility.

Метод класса: WC_Checkout{}

Хуков нет.

Возвращает

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

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

$WC_Checkout = new WC_Checkout();
$WC_Checkout->__set( $key, $value );
$key(строка) (обязательный)
Key.
$value(разное) (обязательный)
Value.

Код WC_Checkout::__set() WC 8.7.0

public function __set( $key, $value ) {
	switch ( $key ) {
		case 'enable_signup':
			$bool_value = wc_string_to_bool( $value );

			if ( $bool_value !== $this->is_registration_enabled() ) {
				remove_filter( 'woocommerce_checkout_registration_enabled', '__return_true', 0 );
				remove_filter( 'woocommerce_checkout_registration_enabled', '__return_false', 0 );
				add_filter( 'woocommerce_checkout_registration_enabled', $bool_value ? '__return_true' : '__return_false', 0 );
			}
			break;
		case 'enable_guest_checkout':
			$bool_value = wc_string_to_bool( $value );

			if ( $bool_value === $this->is_registration_required() ) {
				remove_filter( 'woocommerce_checkout_registration_required', '__return_true', 0 );
				remove_filter( 'woocommerce_checkout_registration_required', '__return_false', 0 );
				add_filter( 'woocommerce_checkout_registration_required', $bool_value ? '__return_false' : '__return_true', 0 );
			}
			break;
		case 'checkout_fields':
			$this->fields = $value;
			break;
		case 'shipping_methods':
			WC()->session->set( 'chosen_shipping_methods', $value );
			break;
		case 'posted':
			$this->legacy_posted_data = $value;
			break;
	}
}