Documentation
ShipLabel
Developer Reference

ShipLabel Developer Reference


Constants

ConstantDescription
SHIPLABEL_VERSIONPlugin version
SHIPLABEL_FILEAbsolute path to the main plugin file
SHIPLABEL_PATHPlugin directory path
SHIPLABEL_URLPlugin URL
SHIPLABEL_LABELS_DIRAbsolute path of the label file folder (uploads/shiplabel-labels/)
SHIPLABEL_LABELS_URLURL of the label file folder (not publicly accessible)
SHIPLABEL_LICENSE_OPTIONOption name storing the license key
SHIPLABEL_LICENSE_STATUS_OPTIONOption name storing the license status

Class Map

ClassFile
ShipLabel_Adminincludes/admin/class-shiplabel-admin.php
ShipLabel_Admin_Bulk_Actionsincludes/admin/class-shiplabel-admin-bulk-actions.php
ShipLabel_Admin_Order_List_Columnincludes/admin/class-shiplabel-admin-order-list-column.php
ShipLabel_Admin_Order_Metaboxincludes/admin/class-shiplabel-admin-order-metabox.php
ShipLabel_REST_Controllerincludes/api/class-shiplabel-rest-controller.php
ShipLabel_Carrier_Baseincludes/carriers/class-shiplabel-carrier-base.php
ShipLabel_USPS_APIincludes/carriers/class-shiplabel-usps-api.php
ShipLabel_FedEx_APIincludes/carriers/class-shiplabel-fedex-api.php
ShipLabel_USPS_Shipping_Providerincludes/carriers/class-shiplabel-usps-shipping-provider.php
ShipLabel_FedEx_Shipping_Providerincludes/carriers/class-shiplabel-fedex-shipping-provider.php
ShipLabel_Shipping_Method_USPSincludes/class-shiplabel-shipping-method-usps.php
ShipLabel_Shipping_Method_FedExincludes/class-shiplabel-shipping-method-fedex.php
ShipLabel_Settingsincludes/class-shiplabel-settings.php
ShipLabel_Installincludes/class-shiplabel-install.php
ShipLabel_Tracking_Webhookincludes/class-shiplabel-tracking-webhook.php
ShipLabel_Fulfillment_Managerincludes/fulfillment/class-shiplabel-fulfillment-manager.php
ShipLabel_Label_Storeincludes/fulfillment/class-shiplabel-label-store.php

REST Namespace

shiplabel/v1 - see REST API for the full endpoint list.


Cron Events

HookScheduleDescription
shiplabel_sync_tracking_statusesTwice dailyPolls carriers for tracking updates on up to 100 active labels, then deletes label files past the retention period

AJAX Actions

ActionDescription
shiplabel_save_settingsUnified settings save (all tabs)
shiplabel_reset_settingsReset settings, preserving credentials, USPS payment account and shipper address
shiplabel_test_connectionTest USPS/FedEx sign-in credentials
shiplabel_validate_addressValidate an address against USPS or FedEx
shiplabel_license_actionActivate/deactivate the license key

Filters

FilterArgumentsDescription
shiplabel_fulfillment_class$class (string)Override the WooCommerce Fulfillment class ShipLabel instantiates in Order Fulfillments Mode
shiplabel_fedex_customs_commodity$commodity (array), $item (array), $params (array)Filter one customs line of a FedEx international label - e.g. add a harmonized (HS) code or change countryOfManufacture. $item has description, quantity and unit_value; $params is the full label request

Example - add an HS code to every customs line:

add_filter( 'shiplabel_fedex_customs_commodity', function ( array $commodity, array $item ) {
    $commodity['harmonizedCode'] = '6505.00';
    return $commodity;
}, 10, 2 );

Actions Fired

ActionWhen
woocommerce_fulfillment_created_notificationWooCommerce's own hook, fired after ShipLabel creates a fulfillment marked Fulfilled, so WooCommerce sends its customer email

Data Storage

NameTypeContents
{prefix}shiplabel_labelsTableOne row per label: order, carrier, service, tracking number, file, cost, status
{prefix}shiplabel_tracking_eventsTableTracking events per label
shiplabel_settingsOptionAll settings below
shiplabel_webhook_secretOptionTracking webhook secret (blank = unsigned requests accepted)
shiplabel_usps_token, shiplabel_fedex_tokenTransientsCarrier sign-in tokens
shiplabel_usps_payment_tokenTransientUSPS payment authorization, kept 7 hours
shiplabel_usps_rates_*, shiplabel_fedex_rates_*TransientsCheckout rate cache, 30 minutes

Saving settings clears the carrier and USPS payment tokens.


Default Settings

Stored in the shiplabel_settings option (ShipLabel_Settings::defaults()):

KeyDefaultDescription
usps_enabled / fedex_enablednoCarrier master toggles
usps_env / fedex_envproductionproduction or sandbox
usps_client_id, usps_client_secret-USPS app credentials
usps_crid, usps_mid, usps_eps_account-USPS payment account, needed for labels
usps_manifest_mid-Optional; falls back to usps_mid
fedex_client_id, fedex_client_secret, fedex_account_number-FedEx credentials and account
usps_default_servicePRIORITY_MAIL-
fedex_default_serviceFEDEX_GROUND-
usps_label_format / fedex_label_formatPDFUSPS: PDF, TIFF. FedEx: PDF, PNG, ZPLII
shipper_countryUS-
default_carrieruspsusps or fedex
default_weight_unitoz-
default_dim_unitin-
default_package_typepackage-
auto_generate_labelno-
auto_fulfill_on_labelno-
label_file_retention90Days
debug_modeno-

The license key and status are stored as separate options, not inside shiplabel_settings.


Service Codes

USPS: PRIORITY_MAIL_EXPRESS, PRIORITY_MAIL, USPS_GROUND_ADVANTAGE, FIRST-CLASS_PACKAGE_SERVICE, MEDIA_MAIL, LIBRARY_MAIL

FedEx: FEDEX_GROUND, GROUND_HOME_DELIVERY, FEDEX_2_DAY, FEDEX_2_DAY_AM, FEDEX_EXPRESS_SAVER, STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FIRST_OVERNIGHT, INTERNATIONAL_ECONOMY, FEDEX_INTERNATIONAL_PRIORITY, FEDEX_INTERNATIONAL_CONNECT_PLUS

The older INTERNATIONAL_PRIORITY code is still accepted and treated as FEDEX_INTERNATIONAL_PRIORITY.