WC_Shortcode_Checkout
in package
Shortcode checkout class.
Table of Contents
- get() : string
- Get the shortcode content.
- output() : mixed
- Output the shortcode.
- checkout() : mixed
- Show the checkout.
- get_order_preselected_gateway() : WC_Payment_Gateway|null
- Get the gateway to pre-select on the pay page, when it should differ from the default selection.
- guest_should_verify_email() : bool
- Tries to determine if the user's email address should be verified before rendering either the 'order received' or 'order pay' pages. This should only be applied to guest orders.
- order_pay() : mixed
- Show the pay page.
- order_received() : mixed
- Show the thanks page.
- print_notice() : void
- Print a notice inside the shared notices wrapper.
Methods
get()
Get the shortcode content.
public
static get(array<string|int, mixed> $atts) : string
Parameters
- $atts : array<string|int, mixed>
-
Shortcode attributes.
Return values
string —output()
Output the shortcode.
public
static output(array<string|int, mixed> $atts) : mixed
Parameters
- $atts : array<string|int, mixed>
-
Shortcode attributes.
Return values
mixed —checkout()
Show the checkout.
private
static checkout() : mixed
Return values
mixed —get_order_preselected_gateway()
Get the gateway to pre-select on the pay page, when it should differ from the default selection.
private
static get_order_preselected_gateway(WC_Order $order, array<string|int, WC_Payment_Gateway> $available_gateways) : WC_Payment_Gateway|null
A merchant assigns the method when creating an order in admin, so that assignment is the pre-selection. Orders placed through checkout carry the method the shopper picked, so those keep the default selection.
Parameters
- $order : WC_Order
-
Order being paid for.
- $available_gateways : array<string|int, WC_Payment_Gateway>
-
Gateways available on the pay page, keyed by gateway ID.
Tags
Return values
WC_Payment_Gateway|null —guest_should_verify_email()
Tries to determine if the user's email address should be verified before rendering either the 'order received' or 'order pay' pages. This should only be applied to guest orders.
private
static guest_should_verify_email(WC_Order $order, string $context) : bool
Parameters
- $order : WC_Order
-
The order for which a need for email verification is being determined.
- $context : string
-
The context in which email verification is being tested.
Return values
bool —order_pay()
Show the pay page.
private
static order_pay(int $order_id) : mixed
Parameters
- $order_id : int
-
Order ID.
Tags
Return values
mixed —order_received()
Show the thanks page.
private
static order_received(int $order_id) : mixed
Parameters
- $order_id : int
-
Order ID.
Return values
mixed —print_notice()
Print a notice inside the shared notices wrapper.
private
static print_notice(string $message, string $notice_type) : void
Parameters
- $message : string
-
Notice text.
- $notice_type : string
-
Notice type: error, success or notice.
