Answer the question
In order to leave comments, you need to log in
How in WooCommerce, when the buyer placed an order, the subject of the letter was the city, region?
I would like to set up sorting of letters, based on the city or region in the online store, so that when a new order arrives, the mail filters it and forwards it to couriers from a specific region.
It is necessary that the subject of the letter displays not only the order number, but also the region and city.
tell?)
Answer the question
In order to leave comments, you need to log in
Add your placeholder for the email and specify them in the email subject in the WooCommerce settings.
add_filter( 'woocommerce_email_format_string', 'fink_add_email_placeholders', 10, 2 );
function fink_add_email_placeholders( $string, $email ) {
$order = $email->object;
$placeholders = array(
'{order_city}' => $order->get_billing_city(), // Город заказа
'{order_state}' => $order->get_billing_state(), //Область заказа
);
return str_replace( array_keys( $placeholders ), array_values( $placeholders ), $string );
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question