WC_Checkout::__get( string $key )
Gets the legacy public variables for backwards compatibility.
Description Description
Parameters Parameters
- $key
-
(Required) Key.
Return Return
(array|string)
Source Source
File: includes/class-wc-checkout.php
public function __get( $key ) { if ( in_array( $key, array( 'posted', 'shipping_method', 'payment_method' ), true ) && empty( $this->legacy_posted_data ) ) { $this->legacy_posted_data = $this->get_posted_data(); } switch ( $key ) { case 'enable_signup': return $this->is_registration_enabled(); case 'enable_guest_checkout': return ! $this->is_registration_required(); case 'must_create_account': return $this->is_registration_required() && ! is_user_logged_in(); case 'checkout_fields': return $this->get_checkout_fields(); case 'posted': wc_doing_it_wrong( 'WC_Checkout->posted', 'Use $_POST directly.', '3.0.0' ); return $this->legacy_posted_data; case 'shipping_method': return $this->legacy_posted_data['shipping_method']; case 'payment_method': return $this->legacy_posted_data['payment_method']; case 'customer_id': return apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() ); case 'shipping_methods': return (array) WC()->session->get( 'chosen_shipping_methods' ); } }