Merge pull request #8303 from justinshreve/bulk-edit-webhook-8116
Execute the 'order.updated' webhook when bulk editing and using the status action buttons (fixes #8116)
This commit is contained in:
commit
ecac3fba41
|
@ -1351,6 +1351,7 @@ class WC_Admin_Post_Types {
|
|||
foreach ( $post_ids as $post_id ) {
|
||||
$order = wc_get_order( $post_id );
|
||||
$order->update_status( $new_status, __( 'Order status changed by bulk edit:', 'woocommerce' ) );
|
||||
do_action( 'woocommerce_order_edit_status', $post_id, $new_status );
|
||||
$changed++;
|
||||
}
|
||||
|
||||
|
|
|
@ -465,6 +465,7 @@ class WC_AJAX {
|
|||
if ( wc_is_order_status( 'wc-' . $status ) && $order_id ) {
|
||||
$order = wc_get_order( $order_id );
|
||||
$order->update_status( $status );
|
||||
do_action( 'woocommerce_order_edit_status', $order_id, $status );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -561,6 +561,7 @@ class WC_Webhook {
|
|||
'order.updated' => array(
|
||||
'woocommerce_process_shop_order_meta',
|
||||
'woocommerce_api_edit_order',
|
||||
'woocommerce_order_edit_status',
|
||||
),
|
||||
'order.deleted' => array(
|
||||
'wp_trash_post',
|
||||
|
|
|
@ -58,6 +58,18 @@ if ( ! empty( $apps_keys ) ) {
|
|||
}
|
||||
}
|
||||
|
||||
// Make sure order.update webhooks get the woocommerce_order_edit_status hook
|
||||
$order_update_webhooks = get_posts( array(
|
||||
'posts_per_page' => -1,
|
||||
'post_type' => 'shop_webhook',
|
||||
'meta_key' => '_topic',
|
||||
'meta_value' => 'order.updated'
|
||||
) );
|
||||
foreach ( $order_update_webhooks as $order_update_webhook ) {
|
||||
$webhook = new WC_Webhook( $order_update_webhook->ID );
|
||||
$webhook->set_topic( 'order.updated' );
|
||||
}
|
||||
|
||||
// Update fully refunded orders to ensure they have a refund line item so reports add up
|
||||
$refunded_orders = get_posts( array(
|
||||
'posts_per_page' => -1,
|
||||
|
|
Loading…
Reference in New Issue