Woocommerce get billing state manually
To avoid that error, you have to add something in your function like: add_filter( ‘woocommerce_email_recipient_new_order’, ‘tm_destinatario_condicionado_wc’, 10, 2 ); function tm_destinatario_condicionado_wc( $recipient, $order ) { // To avoid an error in backend if( ! is_a($order, ‘WC_Order’) ) return $recipient; $estados = array( ‘aguascalientes’ => ‘AG’, ‘baja-california’ => ‘BC’, // etc etc … ); // Get … Read more