Important note: These new integrations: WordPress REST API; Tracking meta fields and the plugin helpful functions when making compatible are available since 1.1.0 of premium version only.
1. REST API
a. Authentication
Please refer to WooCommerce’s official documentation https://woocommerce.github.io/woocommerce-rest-api-docs/#authentication
b. Endpoints
-
- Set tracking numbers
/woo-orders-tracking/v1/tracking/set
- Set tracking numbers
Parameter | Required | Type | Default value | Description |
order_id | Yes | Integer | ID of order that you want to set tracking info for | |
tracking_data | Yes | Array | List of tracking info that will be set for this order | |
send_email | Bool | False | Send email if tracking info updated if tracking info updated | |
send_sms | Bool | False | Send sms if tracking info updated if tracking info updated |
tracking_data item properties:
Attribute | Required | Type | Default value | Description |
tracking_number | String | Tracking number | ||
carrier_slug | Yes | String | Slug of carrier that the tracking number belongs to | |
item_id | Integer | ID of order item that the tracking is set for. If empty, the tracking number will be set for the order. | ||
quantity_index | Integer | 1 | Only used if $item_id is valid and item quantity is more than 1 | |
add_to_paypal | Bool | False | Will the tracking number be added to PayPal transaction |
- Get tracking numbers
/woo-orders-tracking/v1/tracking/get
Parameter | Required | Type | Default value | Description |
order_id | Yes | Integer | ID of order that you want to get tracking info | |
empty_tracking | Bool | False | Whether to return items that do not have tracking info |
2. Tracking meta fields
*Only applicable when “Manage tracking by” option is set to “Order only – Each order can only have 1 tracking number at a time”
- Tracking number meta field: _wot_tracking_number
- Tracking carrier meta field: _wot_tracking_carrier
- Shipment status meta field: _wot_tracking_status
If your orders have tracking numbers set for every order item, please use in-built functions.
3. Some functions to use when making compatible with another plugin
VI_WOOCOMMERCE_ORDERS_TRACKING_DATA::set_tracking( $order_id, $tracking_number, $carrier_slug, $item_id, $quantity_index, $add_to_service, $add_to_paypal, $send_email, $send_sms);
Variable | Required | Type | Default value | Description |
$order_id | Yes | Integer | ID of order that the tracking is set for | |
$tracking_number | String | Tracking number | ||
$carrier_slug | Yes | String | Slug of carrier that the tracking number belongs to | |
$item_id | Integer | ID of order item that the tracking is set for. If empty, the tracking number will be set for the order. | ||
$quantity_index | Integer | 1 | Only used if $item_id is valid and item quantity is more than 1 | |
$add_to_service | Bool | True | Will the tracking number be synced with the currently used tracking service | |
$add_to_paypal | Bool | False | Will the tracking number be added to PayPal transaction | |
$send_email | Bool | False | Send email if tracking info updated if tracking info updated | |
$send_sms | Bool | False | Send sms to customer if tracking info updated |
- VI_WOOCOMMERCE_ORDERS_TRACKING_DATA::get_carriers( $only_active )
Variable | Required | Type | Default value | Description |
$only_active | Bool | False | Only return active carriers |
- VI_WOOCOMMERCE_ORDERS_TRACKING_DATA::get_tracking_numbers( $order_id, $empty_tracking )
Variable | Required | Type | Default value | Description |
$order_id | Yes | Integer | ID of order that you want to get tracking info | |
$empty_tracking | Bool | False | Whether to return items that do not have tracking info |
- VI_WOOCOMMERCE_ORDERS_TRACKING_DATA::get_item_tracking_number( $order_id, $item_id, $quantity_index, $empty_tracking )
Variable | Required | Type | Default value | Description |
$order_id | Yes | Integer | ID of order that you want to get tracking info | |
$item_id | Integer | ID of order item that you want to get tracking info. If empty, it will return tracking of the order. | ||
$empty_tracking | Bool | False | Whether to return item detail if it does not have tracking info |