Send a custom notification to customer on WooCommerce cancelled order status
A better solution will be to use all arguments included in woocommerce_order_status_cancelled hooked function, so the missing $order variable. Also as the action hook woocommerce_order_status_cancelled is triggered when order status change to “cancelled”, so in your code, if ($order->has_status(‘cancelled’)) { is not needed. Then your code will be: add_filter(‘woocommerce_order_status_cancelled’, ‘woocommerce_send_mail_abandonned_order’, 10, 2 ); function woocommerce_send_mail_abandonned_order( … Read more