Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

custom order status WordPress


I have custom order status created with a plugin. All status updated with email notifications sent no problem. Status updated through woo admin could trigger SMS working fine. However, cannot find anyway to trigger the SMS through PHP.

So looking for snippet that is able trigger SMS. Any ideas?

Current code:
$new_status = 'x';
$order = new WC_Order($order_id);

I need to trigger SMS custom order status, test it your self

Answers (3)


Reigel Gallarde answers:

upon reading the code, I believe you are not allowed to do that based on the codes...
That plugin is requiring another plugin to be able to use custom order status... this plugin

you might be able to get away with it by editing apg-sms.php on lines 132 - 136...
but then you need to edit inludes\formulario.php too... on lines 330 - 357...

basically what it's currently doing is that if the order status is not in the defaults, it will check if that plugin B created it, otherwise it ignores the order status...

You might want to try this or ask the author himself for clarifications as to why your custom order status is not working..

Reigel Gallarde comments:

I'm not sure if my comment above should work because I have not tried it...

before doing above, you might want to try adding this code in your functions.php, to see if this works..

add_action( 'woocommerce_order_status_x', 'apg_sms_procesa_estados', 10 );

assuming your status is 'x'

email889 comments:

How do I limit only apply "add_action" below If there is apg?
add_action( 'woocommerce_order_status_x', 'apg_sms_procesa_estados', 10 );

Reigel Gallarde comments:

try to check if function exist...

add_action( 'woocommerce_order_status_x', 'apg_sms_procesa_estados', 10 );

email889 comments:

Great! it works. Solved!


Arnav Joy answers:

I am not sure but I think this function will work

wp_remote_get( "" );

email889 comments:

sorry it's different sms.


dimadin answers:

It should probably be something like

add_action( 'woocommerce_order_status_custom', 'apg_sms_procesa_estados', 10 );

where custom is name of your status.

See plugin's code on and WooCommerce's code that triggers it