WC_Checkout::__set( string $key, mixed $value )
Sets the legacy public variables for backwards compatibility.
Description Description
Parameters Parameters
- $key
-
(Required) Key.
- $value
-
(Required) Value.
Source Source
File: includes/class-wc-checkout.php
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; } }