Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
708 views
in Technique[技术] by (71.8m points)

wordpress - Adding field in woo BACS payment settings which will be always "order number" and send it via email to customer

i tried to look everywhere for several hours and could not find anything relevant to what i want. Is there any way to send one more detail in email for new order when BACS was choosen? This detail must have same formatting as rest of the bank details like SWIFT code or account number and would be named "Variabilny symbol" with result of order number. this is what i have now all bank details set in woocommerce BACS payment settings https://snipboard.io/ybu0vk.jpg and i would like to add one more information which would always be the order number with same formatting.

question from:https://stackoverflow.com/questions/65601365/adding-field-in-woo-bacs-payment-settings-which-will-be-always-order-number-an

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I have solution if anyone would be interested:

add_filter( 'woocommerce_bacs_account_fields', 'custom_bacs_account_field', 10, 2);
function custom_bacs_account_field( $account_fields, $order_id ) {
$order = wc_get_order( $order_id );
$account_fields['variable_symbol' ] = array(
'label' => 'NAME FOR THE LABEL GOES HERE',
'value' => $order->get_order_number()
);
return $account_fields;
}

i am not author of this code.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...