Title: Create Label from order programmatically
Last modified: July 29, 2022

---

# Create Label from order programmatically

 *  [sensusdata](https://wordpress.org/support/users/sensusdata/)
 * (@sensusdata)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/create-label-from-order-programmatically/)
 * Hello,
 * Is there a way to programmatically create the label?
    I want to use the plugin
   with my own custom PHP code.
 * Maybe someone has some examples? That would be really helpful.
 * Cheers

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Progressus](https://wordpress.org/support/users/shadim/)
 * (@shadim)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/create-label-from-order-programmatically/#post-15870432)
 * You could create a custom Order Status and then set that programmatically and
   use the setting to create a label on that custom Order Status to make it all 
   work together.
 *  Thread Starter [sensusdata](https://wordpress.org/support/users/sensusdata/)
 * (@sensusdata)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/create-label-from-order-programmatically/#post-15870504)
 * Yes, but error handling would not be very well. I would not know if a label has
   been created or there was an error.
 * I would prefer to use a function to call i.e. to generate a label filled with
   information from an order id or even create a raw label and all information i
   would provide in the array ($args) you are using to create a label from scratch.
 *  Plugin Author [Progressus](https://wordpress.org/support/users/shadim/)
 * (@shadim)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/create-label-from-order-programmatically/#post-15876199)
 * You could take a look at the code when an order status changed and see how it’s
   done there, then do the same programatically.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Create Label from order programmatically’ is closed to new replies.

 * ![](https://ps.w.org/dhl-for-woocommerce/assets/icon.svg?rev=1777040)
 * [DHL Shipping Germany for WooCommerce](https://wordpress.org/plugins/dhl-for-woocommerce/)
 * [Support Threads](https://wordpress.org/support/plugin/dhl-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/dhl-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/dhl-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/dhl-for-woocommerce/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Progressus](https://wordpress.org/support/users/shadim/)
 * Last activity: [3 years, 10 months ago](https://wordpress.org/support/topic/create-label-from-order-programmatically/#post-15876199)
 * Status: not resolved