WooCommerce Code Reference

CartCheckoutUtils
in package

Class containing utility methods for dealing with the Cart and Checkout blocks.

Table of Contents

get_country_data()  : array<string|int, mixed>
Gets country codes, names, states, and locale information.
get_shipping_zones()  : array<string|int, mixed>
Retrieves formatted shipping zones from WooCommerce.
is_cart_block_default()  : bool
Checks if the default cart page is using the Cart block.
is_checkout_block_default()  : bool
Checks if the default checkout page is using the Checkout block.
is_overriden_by_custom_template_content()  : bool
Checks if the template overriding the page loads the page content or not.
deep_sort_with_accents()  : array<string|int, mixed>
Removes accents from an array of values, sorts by the values, then returns the original array values sorted.

Methods

get_country_data()

Gets country codes, names, states, and locale information.

public static get_country_data() : array<string|int, mixed>
Return values
array<string|int, mixed>

get_shipping_zones()

Retrieves formatted shipping zones from WooCommerce.

public static get_shipping_zones() : array<string|int, mixed>
Return values
array<string|int, mixed>An array of formatted shipping zones.

is_cart_block_default()

Checks if the default cart page is using the Cart block.

public static is_cart_block_default() : bool
Return values
booltrue if the WC cart page is using the Cart block.

is_checkout_block_default()

Checks if the default checkout page is using the Checkout block.

public static is_checkout_block_default() : bool
Return values
booltrue if the WC checkout page is using the Checkout block.

is_overriden_by_custom_template_content()

Checks if the template overriding the page loads the page content or not.

public static is_overriden_by_custom_template_content(string $block) : bool

Templates by default load the page content, but if that block is deleted the content can get out of sync with the one presented in the page editor.

Parameters
$block : string

The block to check.

Return values
booltrue if the template has out of sync content.

deep_sort_with_accents()

Removes accents from an array of values, sorts by the values, then returns the original array values sorted.

protected static deep_sort_with_accents(array<string|int, mixed> $array) : array<string|int, mixed>
Parameters
$array : array<string|int, mixed>

Array of values to sort.

Return values
array<string|int, mixed>Sorted array.