Create woocommerce-order-action-resend-completed.php

This commit is contained in:
Viktor Szépe 2024-12-08 10:18:17 +01:00 committed by GitHub
parent 59f88503d0
commit 1007d54752
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,28 @@
<?php
/*
* Plugin Name: WooCommerce resend order completed notification
* Plugin URI: https://github.com/szepeviktor/wordpress-website-lifecycle
*/
add_filter(
'woocommerce_order_actions',
static function ($actions) {
$actions['resend_order_completed'] = 'Resend order completed notification';
return $actions;
},
11,
1
);
add_action(
'woocommerce_order_action_resend_order_completed',
static function (\WC_Order $order) {
WC()->payment_gateways();
WC()->shipping();
WC()->mailer()->emails['WC_Email_Customer_Completed_Order']->trigger($order->get_id(), $order);
$order->add_order_note('Order completed notification resent to customer.', false, true);
},
10,
1
);