I am trying to get WooCommerce to send different emails to customers depending on if they have selected 'Collection' or any delivery method.
If the customer chose to collect, the 'Processing' email must tell them that they will get notified once ready and the 'Completed' email must tell them to come collect.
If the customer chose delivery, the 'Processing' email must tell them they will be notified when its on its way and the 'Completed' email must tell them its on the way.
Currently, I have the following code and nothing is coming up on either email.
I am not sure if what my error is, and I am also not sure if I am using the correct variable names to reference my shipping methods.
add_action ('woocommerce_email_customer_details', 'custom_email_customer_details', 15, 4);
function custom_email_customer_details( $order, $sent_to_admin, $plain_text, $email ){
if ( $order->has_shipping_method('Pickup from PnP Honey Junction') && $new_status == 'processing' ){
echo "<h2>Shipping notice</h2>
<p>You will be notified when to collect your order</p>";
}
elseif($order->has_shipping_method('Pickup from PnP Honey Junction') && $new_status == 'completed'){
echo "<h2>Shipping notice</h2>
<p>Your order is ready for pickup</p>";
}
elseif ( ! $order->has_shipping_method('Pickup from PnP Honey Junction') && $new_status == 'processing' ) {
echo "<h2>Shipping notice</h2>
<p>You will be notified when your order is out for delivery</p>";
}
elseif(! $order->has_shipping_method('Pickup from PnP Honey Junction') && $new_status == 'completed' ) {
echo "<h2>Shipping notice</h2>
<p>Your order is out for delivery</p>";
}
}