I am modifying one of the WooCommerce email templates and adding text based on what payment method is used:
if ( 'bacs' == $order->get_payment_method() ){
echo "We are awaiting payment" ;
echo $order->get_order_number();
}
elseif ( 'paypal' == $order->get_payment_method() ) {
echo "Text2";
}
else {
echo "Text3;
}
I need to add the order ID into the first text (for BACS), so that it would display:
We are awaiting payment. Order reference: 1234 (your order number).
How can I add the order number into my plain text?
2
Answers
you can add string using
.
notation in php.like with
"previous string".$order->get_order_number()
, you can append order number to preceding string.You can use PHP
printf()
to incorporate a variable value in a displayed text string as follows: