• Hello. I need to add an extra field – Variable symbol, which customer need to fill in his bank transfer, to detect and pair the payment. The variable symbol should be equal to order number. I need to add that field into “Bank account details” in e-mail, which is sended, while the order get to the status “on-hold”

    https://snipboard.io/dcI2hO.jpg

    The “Banka”, “IBAN” and “BIC” comes from data, which I have filled in Woocommerce->settings->payments->direct bank pay as details of bank account.

    Is possible to add there the new field “Variable symbol” and the variable {order_number}?

    As you can see in my screenshot, I tried to it in Woocommerce->settings->payments->direct bank pay in Instructions textarea, however the variable is not transferred to the real number. I tried to create my own e-mail template (in my child theme) for on-hold email, however there are only some hook and filter, which I can’t find and edit in code.
    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • The solution with a little life-hack is here:

    
    add_filter( 'woocommerce_bacs_account_fields', 'custom_bacs_account_field', 10, 2);
    function custom_bacs_account_field( $account_fields, $order_id ) {
        static $call_counter = 0;
        if($call_counter > 0 )  {
            return $account_fields;
        }
    
        $order = wc_get_order( $order_id );
        $account_fields['variable_symbol' ] = array(
                'label' => 'Variabilný symbol',
                'value' => $order_id
            );
        $call_counter++;
        return $account_fields;
    }

    Without static variable $call_counter, there is a duplicity of variable symbol: https://snipboard.io/MY6ZaV.jpg
    I was unable to find a reason, why the values are duplicated. So I use that lifehack.

    Plugin Support Stuart Duff – a11n

    (@stuartduff)

    Automattic Happiness Engineer

    Hey @lavadesign,

    It’s great to see you managed to find a code-based solution that possibly works for you 🙂

    I’m going to mark this as resolved – if you have any further questions, you can reopen it again if you need be.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding order_number as variable symbol in on-hold e-mails’ is closed to new replies.