WooCommerce Code Reference

ShippingPartnerSuggestions extends RemoteSpecsEngine
in package

Class ShippingPartnerSuggestions

Table of Contents

get_specs()  : mixed
Get specs or fetch remotely if they don't exist.
get_suggestions()  : array<string|int, mixed>
Go through the specs and run them.
log_errors()  : mixed
Log errors.
sort_by_primary()  : array<string|int, mixed>
Sort suggestions so that partners whose countries_where_primary list contains the current store country appear first.

Methods

get_suggestions()

Go through the specs and run them.

public static get_suggestions([array<string|int, mixed>|null $specs = null ]) : array<string|int, mixed>
Parameters
$specs : array<string|int, mixed>|null = null

shipping partner suggestion spec array.

Return values
array<string|int, mixed>

log_errors()

Log errors.

public static log_errors([array<string|int, mixed> $errors = array() ]) : mixed
Parameters
$errors : array<string|int, mixed> = array()

Array of errors from \Throwable interface.

Return values
mixed

sort_by_primary()

Sort suggestions so that partners whose countries_where_primary list contains the current store country appear first.

private static sort_by_primary(array<string|int, mixed> $suggestions) : array<string|int, mixed>
Parameters
$suggestions : array<string|int, mixed>

Suggestions to sort.

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