+// Send a notification to Domoticz when a new Order is processing/completed
+function custom_woocommerce_order_status_completed_notification( $order_id = 0 ) {
+ // Bail out if no Order ID has been provided
+ if( empty( $order_id ) )
+ // Bail out if it’s a free Order (0.00 total)
+ $order_total = get_post_meta( $order_id, '_order_total', false );
+ if( empty( $order_total ) || $order_total = '0.00' )
+ // CURL notification to Domoticz, increase the Orders count by 1
+ $domoticz_url = 'http://nas.visser.io:8080';
+ $domoticz_username = 'username';
+ $domoticz_password = 'password';
+ $base64_string = base64_encode( $domoticz_username . ':' . $domoticz_password );
+ 'Authorization' => 'Basic ' . $base64_string
+ $url = $domoticz_url . '/json.htm?type=command¶m=udevice&idx=' . $idx . '&svalue=1';
+ wp_remote_get( $url, $args );
+add_action( 'woocommerce_order_status_completed', 'custom_woocommerce_order_status_completed_notification' );