Home > Blockchain >  woocommerce hook on custom order status changed
woocommerce hook on custom order status changed

Time:01-23

hey I was trying to make a plugin that sends WhatsApp messages on order status change so this is my code

add_action("woocommerce_order_status_changed", "order_status_wapp",10,3); 
function order_status_wapp($order_id, $old_status, $new_status){  
 if( $new_status == "processing" && carbon_get_theme_option( 'show_processing' )) {       require("incl/apicall.php");  
$message = carbon_get_theme_option( 'processing_message' );       
require("incl/message_attr.php");            
}

the code is working well when changing the status from the order table area ( actions ), but changing the status from the order details or programmatically shows no effect. is there any hook that triggers status change no matter what the way of changing is?

CodePudding user response:

in the end, it worked.

My issue was that I was testing the event with the ACF Update field, which did not work.

However, when I changed it to the main event (send SMS), it worked perfectly.

  • Related