woocommerce_rest_order_actions_email_valid_template_classes
Filter the list of valid email templates for a given order.
Note that the email class must also exist in WC_Emails::$emails.
When adding a custom email template to this list, a callback must also be added to trigger the sending of the email. See the woocommerce_rest_order_actions_email_send hook.
Использование
add_filter( 'woocommerce_rest_order_actions_email_valid_template_classes', 'wp_kama_woocommerce_rest_order_actions_email_valid_template_classes_filter', 10, 2 ); /** * Function for `woocommerce_rest_order_actions_email_valid_template_classes` filter-hook. * * @param string[] $valid_template_classes Array of email template class names that are valid for a given order. * @param WC_Order $order The order. * * @return string[] */ function wp_kama_woocommerce_rest_order_actions_email_valid_template_classes_filter( $valid_template_classes, $order ){ // filter... return $valid_template_classes; }
- $valid_template_classes(string[])
- Array of email template class names that are valid for a given order.
- $order(WC_Order)
- The order.
Список изменений
С версии 9.8.0 | Введена. |
Где вызывается хук
woocommerce_rest_order_actions_email_valid_template_classes
woocommerce/src/Internal/Orders/OrderActionsRestController.php 331-335
$valid_template_classes = apply_filters( 'woocommerce_rest_order_actions_email_valid_template_classes', $valid_template_classes, $order );