Define custom actions


In the settings under “Track Consignments > Settings > Actions” in the “Actions” field you can define which actions will be triggered for specific shipment events (see 3. Define actions for shipment events). In addition to sending emails and changing the order status, it is also possible to define your own actions. Using your own code (e.g. in the theme’s functions.php file) you can respond to the shipment event accordingly.

The name of the action hook will be visible on the added action and corresponds to the format mame_st_action_[id]. For example, if the hook is mame_st_action_1643047633150, a custom action could be performed using the following code:

add_action('mame_st_action_1643047633150', 'my_custom_action', 10, 2);

function my_custom_action($event, $wc_order) {

  // Do something

}

The following parameters are passed to the hook function:

  • Mame_St\models\Event $event: Object representing the send event with the following properties:
    • $code : The event code of the post.
    • $description_de : The description of the event in German.
    • $description_en : The description of the event in English.
    • $description_fr : The description of the event in French.
    • $description_it : The description of the event in Italian
  • WC_Order $order : A WooCommerce WC_Order object representing the WooCommerce order.