PHP Класс WC_Checkout

The WooCommerce checkout class handles the checkout process, collecting user data and processing the payment.
Автор: WooThemes
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$fields array | null Checkout fields are stored here.
$instance WC_Checkout | null The single instance of the class.

Открытые методы

Метод Описание
__clone ( ) Cloning is forbidden.
__get ( string $key ) : string Gets the legacy public variables for backwards compatibility.
__isset ( string $key ) : boolean See if variable is set. Used to support legacy public variables which are no longer defined.
__set ( string $key, mixed $value ) Sets the legacy public variables for backwards compatibility.
__wakeup ( ) Unserializing instances of this class is forbidden.
check_cart_items ( ) When we process the checkout, lets ensure cart items are rechecked to prevent checkout.
checkout_form_billing ( ) Output the billing form.
checkout_form_shipping ( ) Output the shipping form.
create_order ( $data ) : integer | WP_ERROR Create an order. Error codes: 520 - Cannot insert order into the database.
get_checkout_fields ( string $fieldset = '' ) : array Get an array of checkout fields.
get_posted_address_data ( string $key, string $type = 'billing' ) : string Get a posted address field after sanitization and validation.
get_value ( string $input ) : string | null Gets the value either from the posted data, or from the users meta data.
instance ( ) : WC_Checkout Gets the main WC_Checkout Instance.
is_registration_enabled ( ) : boolean Is registration enabled on the checkout page?
is_registration_required ( ) : boolean Is registration required to checkout?
process_checkout ( ) Process the checkout after the confirm order button is pressed.

Защищенные методы

Метод Описание
create_order_coupon_lines ( WC_Order &$order ) Add coupon lines to the order.
create_order_fee_lines ( WC_Order &$order ) Add fees to the order.
create_order_line_items ( WC_Order &$order ) Add line items to the order.
create_order_shipping_lines ( WC_Order &$order ) Add shipping lines to the order.
create_order_tax_lines ( WC_Order &$order ) Add tax lines to the order.
get_posted_data ( ) : array Get posted data from the checkout form.
maybe_skip_fieldset ( string $fieldset_key, array $data ) See if a fieldset should be skipped.
process_customer ( array $data ) Create a new customer account if needed.
process_order_payment ( integer $order_id, string $payment_method ) Process an order that does require payment.
process_order_without_payment ( integer $order_id ) Process an order that doesn't require payment.
send_ajax_failure_response ( ) If checkout failed during an AJAX call, send failure response.
update_session ( array $data ) Update customer and session data from the posted checkout data.
validate_checkout ( array &$data, WP_Error &$errors ) Validates that the checkout has enough info to proceed.
validate_posted_data ( array &$data, WP_Error &$errors ) Validates the posted checkout data based on field properties.

Описание методов

__clone() публичный Метод

Cloning is forbidden.
public __clone ( )

__get() публичный Метод

Gets the legacy public variables for backwards compatibility.
public __get ( string $key ) : string
$key string
Результат string

__isset() публичный Метод

See if variable is set. Used to support legacy public variables which are no longer defined.
public __isset ( string $key ) : boolean
$key string
Результат boolean

__set() публичный Метод

Sets the legacy public variables for backwards compatibility.
public __set ( string $key, mixed $value )
$key string
$value mixed

__wakeup() публичный Метод

Unserializing instances of this class is forbidden.
public __wakeup ( )

check_cart_items() публичный Метод

When we process the checkout, lets ensure cart items are rechecked to prevent checkout.
public check_cart_items ( )

checkout_form_billing() публичный Метод

Output the billing form.

checkout_form_shipping() публичный Метод

Output the shipping form.

create_order() публичный Метод

521 - Cannot get order after creation. 522 - Cannot update order. 525 - Cannot create line item. 526 - Cannot create fee item. 527 - Cannot create shipping item. 528 - Cannot create tax item. 529 - Cannot create coupon item.
public create_order ( $data ) : integer | WP_ERROR
$data Posted data.
Результат integer | WP_ERROR

create_order_coupon_lines() защищенный Метод

Add coupon lines to the order.
protected create_order_coupon_lines ( WC_Order &$order )
$order WC_Order

create_order_fee_lines() защищенный Метод

Add fees to the order.
protected create_order_fee_lines ( WC_Order &$order )
$order WC_Order

create_order_line_items() защищенный Метод

Add line items to the order.
protected create_order_line_items ( WC_Order &$order )
$order WC_Order

create_order_shipping_lines() защищенный Метод

Add shipping lines to the order.
protected create_order_shipping_lines ( WC_Order &$order )
$order WC_Order

create_order_tax_lines() защищенный Метод

Add tax lines to the order.
protected create_order_tax_lines ( WC_Order &$order )
$order WC_Order

get_checkout_fields() публичный Метод

Get an array of checkout fields.
public get_checkout_fields ( string $fieldset = '' ) : array
$fieldset string to get.
Результат array

get_posted_address_data() публичный Метод

Get a posted address field after sanitization and validation.
public get_posted_address_data ( string $key, string $type = 'billing' ) : string
$key string
$type string billing for shipping
Результат string

get_posted_data() защищенный Метод

Get posted data from the checkout form.
С версии: 2.7.0
protected get_posted_data ( ) : array
Результат array of data and errors.

get_value() публичный Метод

Gets the value either from the posted data, or from the users meta data.
public get_value ( string $input ) : string | null
$input string
Результат string | null

instance() публичный статический Метод

Gets the main WC_Checkout Instance.
С версии: 2.1
public static instance ( ) : WC_Checkout
Результат WC_Checkout Main instance

is_registration_enabled() публичный Метод

Is registration enabled on the checkout page?
С версии: 2.7.0
public is_registration_enabled ( ) : boolean
Результат boolean

is_registration_required() публичный Метод

Is registration required to checkout?
С версии: 2.7.0
public is_registration_required ( ) : boolean
Результат boolean

maybe_skip_fieldset() защищенный Метод

See if a fieldset should be skipped.
С версии: 2.7.0
protected maybe_skip_fieldset ( string $fieldset_key, array $data )
$fieldset_key string
$data array

process_checkout() публичный Метод

Process the checkout after the confirm order button is pressed.
public process_checkout ( )

process_customer() защищенный Метод

Create a new customer account if needed.
protected process_customer ( array $data )
$data array

process_order_payment() защищенный Метод

Process an order that does require payment.
С версии: 2.7.0
protected process_order_payment ( integer $order_id, string $payment_method )
$order_id integer
$payment_method string

process_order_without_payment() защищенный Метод

Process an order that doesn't require payment.
С версии: 2.7.0
protected process_order_without_payment ( integer $order_id )
$order_id integer

send_ajax_failure_response() защищенный Метод

If checkout failed during an AJAX call, send failure response.

update_session() защищенный Метод

Update customer and session data from the posted checkout data.
С версии: 2.7.0
protected update_session ( array $data )
$data array

validate_checkout() защищенный Метод

Validates that the checkout has enough info to proceed.
С версии: 2.7.0
protected validate_checkout ( array &$data, WP_Error &$errors )
$data array An array of posted data.
$errors WP_Error

validate_posted_data() защищенный Метод

Validates the posted checkout data based on field properties.
С версии: 2.7.0
protected validate_posted_data ( array &$data, WP_Error &$errors )
$data array An array of posted data.
$errors WP_Error

Описание свойств

$fields защищенное свойство

Checkout fields are stored here.
protected array|null $fields
Результат array | null

$instance защищенное статическое свойство

The single instance of the class.
protected static WC_Checkout|null $instance
Результат WC_Checkout | null