Menu

## WC_Shipping_Shipcloud_Utils
in package

class-wc-shipping-shipcloud-utils.php : 19

### Table of Contents

CARRIERS_WITH_UNDERSCORE = array('angel_de', 'cargo_international', 'db_schenker', 'dhl_express', 'parcel_one')
  Carrier names that need special handling
__construct() : void
  Construct
add_admin_notice() : void
  Adds a certain admin notice.
array_insert() : array<string|int, mixed>
  Insert an array at an arbitrary position of another array.
clear_all_admin_notices() : void
  Clears all admin notices.
clear_success_admin_notices() : void
  Clears success admin notices.
convert_exception_to_wp_error() : WP_Error
  Turn exceptions into \WP_Error
convert_postmeta_to_shipment() : array<string|int, mixed>
  Converts postmeta data to shipment data.
convert_shipment_to_postmeta() : array<string|int, mixed>
  Converts shipment data to postmeta data.
convert_to_wc_api_response() : array<string|int, mixed>
  Converts a shipment array to API response.
disassemble_carrier_name() : array<string|int, mixed>
  Splitting carrier name into API usable carrier name and service name
enhance_shipment_data() : array<string|int, mixed>
  Enhances shipment data.
explode_name() : mixed
  Splitting name for getting first and last names separate
explode_street() : mixed
  Splitting Address for getting number of street and street separate
extract_additional_services() : array<string|int, mixed>
  Extract additional services from shipment
filter_additional_services() : mixed
find_order_by_shipment_id() : null|WC_Order
  Find order by shipment id.
format_price() : mixed
get_additional_services() : array<string|int, mixed>
  Gets additional services for carrier.
get_available_shipping_services() : array<string|int, mixed>
  Gets available shipping services.
get_carrier_contents_types() : array<string|int, mixed>
  Gets carrier contents types.
get_carrier_display_name() : string
  Get carrier display_name from name
get_carrier_display_name_short() : string|array<string|int, mixed>
  Getting display name for a carrier (short name) including service
get_carrier_label_formats() : array<string|int, mixed>
  Gets carrier label formats.
get_carrier_name_by_display_name() : array<string|int, mixed>|bool
  Extracts technical carrier name by carrier display name.
get_carrier_providing_pickup_service() : array<string|int, mixed>
  Gets carrier providing pickup service.
get_carrier_services() : array<string|int, mixed>
  Gets carrier services.
get_carrier_services_list() : array<string|int, mixed>
  Gets carrier services as key - value list.
get_carrier_tracking_url() : string
  Getting the carrier tracking URL by specifying the carrier name and tracking number
get_cod_id() : string
  Resolve the correct identifier for cash on delivery.
get_customs_declaration_contents_types() : array<string|int, mixed>
  Gets customs declaration contents types.
get_log_file_path() : string
  Getting the log file path
get_option() : mixed|string
  Getting option (overwrite instance values if there option of instance is empty
get_order_meta_shipment_data() : array<string|int, mixed>|bool
  Gets order meta shipment data.
get_package_label() : string
  Turn package type to readable label.
get_package_types() : array<string|int, mixed>
  Gets package types.
get_parcel_description() : mixed|string
  Receive the parcel description of an order.
get_parcel_templates() : array<string|int, mixed>
  Gets Parcel Templates
get_plugin_options() : mixed
  Gets plugin options.
get_service_name() : string
  Getting service name by carrier service slug
get_shipment_for_order() : array<string|int, mixed>
  Get array representing shipment.
get_shipping_method() : bool|WC_Shipcloud_Shipping
  Returns the object of the shipping method
get_status_icon() : string
  Getting shipment status icon
get_status_string() : string
  Getting shipment status string
log() : void
  Output a debug message.
remove_admin_notice() : void
  Removes a certain admin notice.
shipcloud_admin_is_on_single_order_page() : bool
  Checking if admin is on a single order page
show_admin_notices() : string
  Displays admin notices.
is_debug_enabled() : bool
  Is debug mode enabled

### Constants

#### CARRIERS_WITH_UNDERSCORE

class-wc-shipping-shipcloud-utils.php : 24

Carrier names that need special handling

`public mixed CARRIERS_WITH_UNDERSCORE = array('angel_de', 'cargo_international', 'db_schenker', 'dhl_express', 'parcel_one')`

### Methods

#### __construct()

class-wc-shipping-shipcloud-utils.php : 37

Construct

`public __construct() : void`

##### Return values

void —

#### add_admin_notice()

class-wc-shipping-shipcloud-utils.php : 69

Adds a certain admin notice.

`public static add_admin_notice([string $message = '' ][, string $type = 'info' ][, bool $dismissible = true ]) : void`

##### Parameters

$message : string = ''
$type : string = 'info'
$dismissible : bool = true

##### Return values

void —

#### array_insert()

class-wc-shipping-shipcloud-utils.php : 1119

Insert an array at an arbitrary position of another array.

`public static array_insert(array<string|int, mixed> $array, int $position, array<string|int, mixed> $insert_array) : array<string|int, mixed>`

##### Parameters

$array : array<string|int, mixed>
$position : int
$insert_array : array<string|int, mixed>

##### Return values

array<string|int, mixed> —

#### clear_all_admin_notices()

class-wc-shipping-shipcloud-utils.php : 121

Clears all admin notices.

`public static clear_all_admin_notices() : void`

##### Return values

void —

#### clear_success_admin_notices()

class-wc-shipping-shipcloud-utils.php : 130

Clears success admin notices.

`public static clear_success_admin_notices() : void`

##### Return values

void —

#### convert_exception_to_wp_error()

class-wc-shipping-shipcloud-utils.php : 1199

Turn exceptions into \WP_Error

`public static convert_exception_to_wp_error(Exception $exception) : WP_Error`

##### Parameters

$exception : Exception

##### Return values

WP_Error —

#### convert_postmeta_to_shipment()

class-wc-shipping-shipcloud-utils.php : 735

Converts postmeta data to shipment data.

`public static convert_postmeta_to_shipment(array<string|int, mixed> $postmeta) : array<string|int, mixed>`

##### Parameters

$postmeta : array<string|int, mixed>

##### Return values

array<string|int, mixed> —

#### convert_shipment_to_postmeta()

class-wc-shipping-shipcloud-utils.php : 673

Converts shipment data to postmeta data.

`public static convert_shipment_to_postmeta(array<string|int, mixed> $shipment) : array<string|int, mixed>`

##### Parameters

$shipment : array<string|int, mixed>

##### Return values

array<string|int, mixed> —

#### convert_to_wc_api_response()

class-wc-shipping-shipcloud-utils.php : 814

Converts a shipment array to API response.

`public static convert_to_wc_api_response(array<string|int, mixed> $shipment[, string $order_id = null ]) : array<string|int, mixed>`

##### Parameters

$shipment : array<string|int, mixed>
$order_id : string = null

##### Return values

array<string|int, mixed> —

#### disassemble_carrier_name()

class-wc-shipping-shipcloud-utils.php : 272

Splitting carrier name into API usable carrier name and service name

`public static disassemble_carrier_name(string $carrier_name) : array<string|int, mixed>`

##### Parameters

$carrier_name : string

##### Return values

array<string|int, mixed> —

#### enhance_shipment_data()

class-wc-shipping-shipcloud-utils.php : 876

Enhances shipment data.

`public static enhance_shipment_data(array<string|int, mixed> $shipment) : array<string|int, mixed>`

##### Parameters

$shipment : array<string|int, mixed>

##### Return values

array<string|int, mixed> —

#### explode_name()

class-wc-shipping-shipcloud-utils.php : 1166

Splitting name for getting first and last names separate

`public static explode_name(string $name) : mixed`

##### Parameters

$name : string

##### Return values

mixed —

$matches

#### explode_street()

class-wc-shipping-shipcloud-utils.php : 1134

Splitting Address for getting number of street and street separate

`public static explode_street(string $street) : mixed`

##### Parameters

$street : string

##### Return values

mixed —

$matches

#### extract_additional_services()

class-wc-shipping-shipcloud-utils.php : 917

Extract additional services from shipment

`public static extract_additional_services( $shipment) : array<string|int, mixed>`

##### Parameters

$shipment :

##### Return values

array<string|int, mixed> —

$additional_services

#### filter_additional_services()

class-wc-shipping-shipcloud-utils.php : 589
`public static filter_additional_services(mixed $data, mixed $carrier) : mixed`

##### Parameters

$data : mixed
$carrier : mixed

##### Return values

mixed —

#### find_order_by_shipment_id()

class-wc-shipping-shipcloud-utils.php : 607

Find order by shipment id.

`public static find_order_by_shipment_id( $shipment_id) : null|WC_Order`

##### Parameters

$shipment_id :

##### Return values

null|WC_Order —

#### format_price()

class-wc-shipping-shipcloud-utils.php : 862
`public static format_price(mixed $price) : mixed`

##### Parameters

$price : mixed

##### Return values

mixed —

#### get_additional_services()

class-wc-shipping-shipcloud-utils.php : 577

Gets additional services for carrier.

`public static get_additional_services([mixed $carrier_name = '' ]) : array<string|int, mixed>`

##### Parameters

$carrier_name : mixed = ''

##### Return values

array<string|int, mixed> —

#### get_available_shipping_services()

class-wc-shipping-shipcloud-utils.php : 524

Gets available shipping services.

`public static get_available_shipping_services(array<string|int, mixed> $shipcloud_carriers) : array<string|int, mixed>`

##### Parameters

$shipcloud_carriers : array<string|int, mixed>

##### Return values

array<string|int, mixed> —

#### get_carrier_contents_types()

class-wc-shipping-shipcloud-utils.php : 404

Gets carrier contents types.

`public static get_carrier_contents_types() : array<string|int, mixed>`

##### Return values

array<string|int, mixed> —

The carrier contents types.

#### get_carrier_display_name()

class-wc-shipping-shipcloud-utils.php : 239

Get carrier display_name from name

`public static get_carrier_display_name(mixed $carrier_name) : string`

##### Parameters

$carrier_name : mixed

##### Return values

string —

$display_name

#### get_carrier_display_name_short()

class-wc-shipping-shipcloud-utils.php : 257

Getting display name for a carrier (short name) including service

`public static get_carrier_display_name_short(string $carrier_name) : string|array<string|int, mixed>`

##### Parameters

$carrier_name : string

##### Return values

string|array<string|int, mixed> —

#### get_carrier_label_formats()

class-wc-shipping-shipcloud-utils.php : 425

Gets carrier label formats.

`public static get_carrier_label_formats() : array<string|int, mixed>`

##### Return values

array<string|int, mixed> —

The carrier label formats.

#### get_carrier_name_by_display_name()

class-wc-shipping-shipcloud-utils.php : 324

Extracts technical carrier name by carrier display name.

`public static get_carrier_name_by_display_name(string $carrier_display_name) : array<string|int, mixed>|bool`

    	{
    		"carrier": "dhl",
    		"service": "standard"
    	}

##### Parameters

$carrier_display_name : string

##### Return values

array<string|int, mixed>|bool —

#### get_carrier_providing_pickup_service()

class-wc-shipping-shipcloud-utils.php : 341

Gets carrier providing pickup service.

`public static get_carrier_providing_pickup_service() : array<string|int, mixed>`

##### Return values

array<string|int, mixed> —

The carrier providing pickup services.

#### get_carrier_services()

class-wc-shipping-shipcloud-utils.php : 382

Gets carrier services.

`public static get_carrier_services() : array<string|int, mixed>`

##### Return values

array<string|int, mixed> —

The carrier services.

#### get_carrier_services_list()

class-wc-shipping-shipcloud-utils.php : 352

Gets carrier services as key - value list.

`public static get_carrier_services_list() : array<string|int, mixed>`

##### Return values

array<string|int, mixed> —

The carrier services.

#### get_carrier_tracking_url()

class-wc-shipping-shipcloud-utils.php : 438

Getting the carrier tracking URL by specifying the carrier name and tracking number

`public static get_carrier_tracking_url(string $carrier, string $carrier_tracking_no) : string`

##### Parameters

$carrier : string
$carrier_tracking_no : string

##### Return values

string —

URL of the carrier tracking page

#### get_cod_id()

class-wc-shipping-shipcloud-utils.php : 1086

Resolve the correct identifier for cash on delivery.

`public static get_cod_id() : string`

##### Return values

string —

#### get_customs_declaration_contents_types()

class-wc-shipping-shipcloud-utils.php : 415

Gets customs declaration contents types.

`public static get_customs_declaration_contents_types() : array<string|int, mixed>`

##### Return values

array<string|int, mixed> —

The contents types.

#### get_log_file_path()

class-wc-shipping-shipcloud-utils.php : 1219

Getting the log file path

`public static get_log_file_path() : string`

##### Return values

string —

log file path

#### get_option()

class-wc-shipping-shipcloud-utils.php : 1045

Getting option (overwrite instance values if there option of instance is empty

`public static get_option([string $key = '' ][, null $empty_value = false ]) : mixed|string`

##### Parameters

$key : string = ''
$empty_value : null = false

##### Return values

mixed|string —

#### get_order_meta_shipment_data()

class-wc-shipping-shipcloud-utils.php : 657

Gets order meta shipment data.

`public static get_order_meta_shipment_data(string $order_id, string $shipment_id) : array<string|int, mixed>|bool`

##### Parameters

$order_id : string
$shipment_id : string

##### Return values

array<string|int, mixed>|bool —

#### get_package_label()

class-wc-shipping-shipcloud-utils.php : 475

Turn package type to readable label.

`public static get_package_label(string $slug) : string`

##### Parameters

$slug : string

##### Return values

string —

The proper label or the slug itself if no label was found.

#### get_package_types()

class-wc-shipping-shipcloud-utils.php : 393

Gets package types.

`public static get_package_types() : array<string|int, mixed>`

##### Return values

array<string|int, mixed> —

The package types.

#### get_parcel_description()

class-wc-shipping-shipcloud-utils.php : 1066

Receive the parcel description of an order.

`public static get_parcel_description(WC_Order $order) : mixed|string`

##### Parameters

$order : WC_Order

##### Return values

mixed|string —

#### get_parcel_templates()

class-wc-shipping-shipcloud-utils.php : 490

Gets Parcel Templates

`public static get_parcel_templates([array<string|int, mixed> $args = [] ]) : array<string|int, mixed>`

##### Parameters

$args : array<string|int, mixed> = []

##### Return values

array<string|int, mixed> —

$parcel_templates Parcel templates in an array

#### get_plugin_options()

class-wc-shipping-shipcloud-utils.php : 1056

Gets plugin options.

`public static get_plugin_options() : mixed`

##### Return values

mixed —

#### get_service_name()

class-wc-shipping-shipcloud-utils.php : 368

Getting service name by carrier service slug

`public static get_service_name(string $slug) : string`

##### Parameters

$slug : string

##### Return values

string —

#### get_shipment_for_order()

class-wc-shipping-shipcloud-utils.php : 640

Get array representing shipment.

`public static get_shipment_for_order( $order_id, $shipment_id) : array<string|int, mixed>`

##### Parameters

$order_id :
$shipment_id :

##### Return values

array<string|int, mixed> —

#### get_shipping_method()

class-wc-shipping-shipcloud-utils.php : 51

Returns the object of the shipping method

`public static get_shipping_method() : bool|WC_Shipcloud_Shipping`

##### Return values

bool|WC_Shipcloud_Shipping —

#### get_status_icon()

class-wc-shipping-shipcloud-utils.php : 188

Getting shipment status icon

`public static get_status_icon(string $status) : string`

##### Parameters

$status : string

##### Return values

string —

$html

#### get_status_string()

class-wc-shipping-shipcloud-utils.php : 150

Getting shipment status string

`public static get_status_string(string $status) : string`

##### Parameters

$status : string

##### Return values

string —

$message

#### log()

class-wc-shipping-shipcloud-utils.php : 1237

Output a debug message.

`public static log([string $message = '' ][, string $level = 'info' ][, mixed $context = [] ]) : void`

##### Parameters

$message : string = ''

  Debug message.

$level : string = 'info'

  Debug level.

$context : mixed = []

  The Debug context.

##### Return values

void —

#### remove_admin_notice()

class-wc-shipping-shipcloud-utils.php : 92

Removes a certain admin notice.

`public static remove_admin_notice([string $message = '' ][, string $type = 'info' ]) : void`

##### Parameters

$message : string = ''
$type : string = 'info'

##### Return values

void —

#### shipcloud_admin_is_on_single_order_page()

class-wc-shipping-shipcloud-utils.php : 1101

Checking if admin is on a single order page

`public static shipcloud_admin_is_on_single_order_page() : bool`

##### Return values

bool —

#### show_admin_notices()

class-wc-shipping-shipcloud-utils.php : 105

Displays admin notices.

`public static show_admin_notices() : string`

##### Return values

string —

#### is_debug_enabled()

class-wc-shipping-shipcloud-utils.php : 1252

Is debug mode enabled

`private static is_debug_enabled() : bool`

##### Return values

bool —

debug enabled

## Search results