ShipLabel Developer Reference
Constants
| Constant | Description |
|---|---|
SHIPLABEL_VERSION | Plugin version |
SHIPLABEL_FILE | Absolute path to the main plugin file |
SHIPLABEL_PATH | Plugin directory path |
SHIPLABEL_URL | Plugin URL |
SHIPLABEL_LABELS_DIR | Absolute path of the label file folder (uploads/shiplabel-labels/) |
SHIPLABEL_LABELS_URL | URL of the label file folder (not publicly accessible) |
SHIPLABEL_LICENSE_OPTION | Option name storing the license key |
SHIPLABEL_LICENSE_STATUS_OPTION | Option name storing the license status |
Class Map
| Class | File |
|---|---|
ShipLabel_Admin | includes/admin/class-shiplabel-admin.php |
ShipLabel_Admin_Bulk_Actions | includes/admin/class-shiplabel-admin-bulk-actions.php |
ShipLabel_Admin_Order_List_Column | includes/admin/class-shiplabel-admin-order-list-column.php |
ShipLabel_Admin_Order_Metabox | includes/admin/class-shiplabel-admin-order-metabox.php |
ShipLabel_REST_Controller | includes/api/class-shiplabel-rest-controller.php |
ShipLabel_Carrier_Base | includes/carriers/class-shiplabel-carrier-base.php |
ShipLabel_USPS_API | includes/carriers/class-shiplabel-usps-api.php |
ShipLabel_FedEx_API | includes/carriers/class-shiplabel-fedex-api.php |
ShipLabel_USPS_Shipping_Provider | includes/carriers/class-shiplabel-usps-shipping-provider.php |
ShipLabel_FedEx_Shipping_Provider | includes/carriers/class-shiplabel-fedex-shipping-provider.php |
ShipLabel_Shipping_Method_USPS | includes/class-shiplabel-shipping-method-usps.php |
ShipLabel_Shipping_Method_FedEx | includes/class-shiplabel-shipping-method-fedex.php |
ShipLabel_Settings | includes/class-shiplabel-settings.php |
ShipLabel_Install | includes/class-shiplabel-install.php |
ShipLabel_Tracking_Webhook | includes/class-shiplabel-tracking-webhook.php |
ShipLabel_Fulfillment_Manager | includes/fulfillment/class-shiplabel-fulfillment-manager.php |
ShipLabel_Label_Store | includes/fulfillment/class-shiplabel-label-store.php |
REST Namespace
shiplabel/v1 - see REST API for the full endpoint list.
Cron Events
| Hook | Schedule | Description |
|---|---|---|
shiplabel_sync_tracking_statuses | Twice daily | Polls carriers for tracking updates on up to 100 active labels, then deletes label files past the retention period |
AJAX Actions
| Action | Description |
|---|---|
shiplabel_save_settings | Unified settings save (all tabs) |
shiplabel_reset_settings | Reset settings, preserving credentials, USPS payment account and shipper address |
shiplabel_test_connection | Test USPS/FedEx sign-in credentials |
shiplabel_validate_address | Validate an address against USPS or FedEx |
shiplabel_license_action | Activate/deactivate the license key |
Filters
| Filter | Arguments | Description |
|---|---|---|
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
| Action | When |
|---|---|
woocommerce_fulfillment_created_notification | WooCommerce's own hook, fired after ShipLabel creates a fulfillment marked Fulfilled, so WooCommerce sends its customer email |
Data Storage
| Name | Type | Contents |
|---|---|---|
{prefix}shiplabel_labels | Table | One row per label: order, carrier, service, tracking number, file, cost, status |
{prefix}shiplabel_tracking_events | Table | Tracking events per label |
shiplabel_settings | Option | All settings below |
shiplabel_webhook_secret | Option | Tracking webhook secret (blank = unsigned requests accepted) |
shiplabel_usps_token, shiplabel_fedex_token | Transients | Carrier sign-in tokens |
shiplabel_usps_payment_token | Transient | USPS payment authorization, kept 7 hours |
shiplabel_usps_rates_*, shiplabel_fedex_rates_* | Transients | Checkout rate cache, 30 minutes |
Saving settings clears the carrier and USPS payment tokens.
Default Settings
Stored in the shiplabel_settings option (ShipLabel_Settings::defaults()):
| Key | Default | Description |
|---|---|---|
usps_enabled / fedex_enabled | no | Carrier master toggles |
usps_env / fedex_env | production | production 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_service | PRIORITY_MAIL | - |
fedex_default_service | FEDEX_GROUND | - |
usps_label_format / fedex_label_format | PDF | USPS: PDF, TIFF. FedEx: PDF, PNG, ZPLII |
shipper_country | US | - |
default_carrier | usps | usps or fedex |
default_weight_unit | oz | - |
default_dim_unit | in | - |
default_package_type | package | - |
auto_generate_label | no | - |
auto_fulfill_on_label | no | - |
label_file_retention | 90 | Days |
debug_mode | no | - |
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.