LocalPickupUtils
in package
Util class for local pickup related functionality, this contains methods that need to be accessed from places besides the ShippingController, i.e. the OrderController.
Table of Contents
- get_local_pickup_method_ids() : array<string|int, string>
- Gets a list of payment method ids that support the 'local-pickup' feature.
- get_local_pickup_method_locations() : array<string|int, mixed>
- Gets local pickup locations for block editor preview, including placeholder locations for custom shipping methods that support local pickup.
- get_local_pickup_settings() : mixed
- Gets the local pickup location settings.
- is_local_pickup_enabled() : bool
- Checks if WC Blocks local pickup is enabled.
- is_local_pickup_method() : bool
- Checks if a method is a local pickup method.
Methods
get_local_pickup_method_ids()
Gets a list of payment method ids that support the 'local-pickup' feature.
public
static get_local_pickup_method_ids() : array<string|int, string>
Return values
array<string|int, string> — List of payment method ids that support the 'local-pickup' feature.get_local_pickup_method_locations()
Gets local pickup locations for block editor preview, including placeholder locations for custom shipping methods that support local pickup.
public
static get_local_pickup_method_locations() : array<string|int, mixed>
This method combines the built-in pickup_location locations with placeholder entries for any other shipping methods that declare 'local-pickup' support. This allows custom shipping methods to appear in the block editor preview.
Tags
Return values
array<string|int, mixed> — Array of pickup locations with the following structure: - 'name' (string) The location name. - 'enabled' (bool) Whether the location is enabled. - 'address' (array) Address array with keys: address_1, city, state, postcode, country. - 'details' (string) Additional details about the location. - 'method_id' (string) The shipping method ID this location belongs to.get_local_pickup_settings()
Gets the local pickup location settings.
public
static get_local_pickup_settings([string $context = 'view' ]) : mixed
Parameters
- $context : string = 'view'
-
The context for the settings. Defaults to 'view'.
Return values
mixed —is_local_pickup_enabled()
Checks if WC Blocks local pickup is enabled.
public
static is_local_pickup_enabled() : bool
Return values
bool — True if local pickup is enabled.is_local_pickup_method()
Checks if a method is a local pickup method.
public
static is_local_pickup_method(string $method_id) : bool
Parameters
- $method_id : string
-
The method id to check.
