WC_Checkout::__set()
Sets the legacy public variables for backwards compatibility.
Method of the class: WC_Checkout{}
No Hooks.
Return
null
. Nothing.
Usage
$WC_Checkout = new WC_Checkout(); $WC_Checkout->__set( $key, $value );
- $key(string) (required)
- Key.
- $value(mixed) (required)
- Value.
WC_Checkout::__set() WC Checkout:: set code WC 7.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; } }