Search Knowledge Base by Keyword

Add the custom description during label printing

The code facilitates you to add the custom description during creating the label for international as well as domestic shipping.
Add the following code to your functions.php or anywhere relevant.

In the above code, $request contains API request data which will be sent to Canada Post during label creation and $order parameter contains order data. This code is given for changing the description to ‘ My Product Description’ as an example.

Note: Custom description can be up to 35 characters, more than that will be truncated.

$xml contains API request. For international shipping, $ref_no as an order number( custom-ref-1 in code) is added with comma and $custom_product_description at end. And Custom Description with order number should not exceed more than 35 characters, more than that will be truncated. For reference,  it appears on the label as highlighted below:

For Domestic shipping, $custom_product_description is added as custom-ref-2.

For reference,  it appears on the label as highlighted below:

Function returns value of $xml.

Last Updated On September 21, 2018