Displaying Order Numbers in WooCommerce BACS Payment Instructions
If you're using the WooCommerce BACS payment gateway, you might want to display the order number in the payment instructions to make it easier for customers to reference their payments. This article will guide you through the process of achieving this.
The Problem
By default, WooCommerce BACS payment instructions don't include the order number. This can make it difficult for customers to track their payments and for you to reconcile orders.
The Solution
There are a couple of ways to display the order number in the BACS payment instructions:
1. Using a Plugin
Several plugins are available that enhance the WooCommerce BACS payment gateway functionality, including displaying order numbers. A popular option is the WooCommerce BACS Payment Gateway Extension by WC Vendors. This plugin allows you to customize the payment instructions and add order information, including the order number.
2. Customizing the BACS Template File
If you're comfortable with coding, you can directly modify the BACS template file to display the order number.
Here's how:
-
Locate the template file: The BACS template file is usually located in the
/woocommerce/templates/checkout/payment-method/bacs.php
directory. -
Edit the file: Open the file in a text editor and find the section where the payment instructions are defined.
-
Add the order number: Insert the following code snippet within the payment instructions section:
<?php echo __( 'Order number:', 'woocommerce' ) . ' ' . $order->get_order_number(); ?>
This code will display the phrase "Order number:" followed by the order number.
3. Using a Code Snippet
You can also add the following code snippet to your functions.php
file in your child theme or a custom plugin:
add_filter( 'woocommerce_bacs_instructions', 'add_order_number_to_bacs_instructions', 10, 2 );
function add_order_number_to_bacs_instructions( $instructions, $order ) {
$instructions .= '<br>' . __( 'Order number:', 'woocommerce' ) . ' ' . $order->get_order_number();
return $instructions;
}
This code snippet adds the order number to the existing payment instructions.
Important: Remember to backup your theme files before making any changes.
Additional Notes
- You can further customize the text and formatting of the order number display within the payment instructions.
- Ensure that the order number is displayed in a clear and prominent position within the payment instructions.
Conclusion
By displaying the order number in the BACS payment instructions, you can improve the user experience for your customers and streamline your order management process. Choose the method that best suits your needs and technical expertise.
Remember: It is essential to test all changes thoroughly before deploying them on your live website.