Hooks for developers
Filters, actions and meta keys of EasyMail Voucher for developers: your phone field, reviews, button and actions after publication.
The plugin has Hooks for customizations without changes in its code. Put your own code in Child theme or in your own small plugin.
Filters#
easymail_voucher_phone_number($phone, $order_id): the recipient’s phone number. Useful if you store the mobile number in a custom checkout field.obs_easymail_voucher_comments($comments, $order_id): notes on the shipping label.obs_courier_obs_easymail_courier_show_generate_voucher_button($show, $order): hide the button according to your own rules. The column then displays Not available.obs_courier_obs_easymail_courier_create_voucher_button_text($text): the button label.obs_courier_obs_easymail_courier_deleting_voucher($voucher_number, $order): the voucher number before cancellation.
Actions#
obs_courier_obs_easymail_courier_voucher_created($order, $voucher_number, $result): after issue.obs_courier_obs_easymail_courier_voucher_deleted($order, $voucher_number): after cancellation.obs_courier_obs_easymail_courier_create_voucher_modal($order): extra fields in the issue dialog.obs_courier_obs_easymail_courier_admin_page_before_settingsand…_after_settings: content above or below the settings.
Example: mobile from your own field#
add_filter( 'easymail_voucher_phone_number', function ( $phone, $order_id ) { $order = wc_get_order( $order_id ); $mobile = $order ? $order->get_meta( '_billing_mobile' ) : ''; return $mobile ?: $phone; }, 10, 2 );
Meta keys of the order#
obs_easymail_courier: the Voucher number.obs_easymail_courier_pieces: the pieces.obs_easymail_courier_date: the day of issue (Y-m-d), used on the daily list.
Errors are written in WooCommerce logs with source obs_easymail_courier.
Send a request; the plugin and the article are automatically completed.