diff --git a/includes/class-wc-countries.php b/includes/class-wc-countries.php index 99e62534e19..d9ec0da0053 100644 --- a/includes/class-wc-countries.php +++ b/includes/class-wc-countries.php @@ -606,10 +606,7 @@ class WC_Countries { ), 'state' => array( 'label' => __( 'State', 'woocommerce' ), - ), - 'sortcode' => array( - 'label' => __( 'BSB', 'woocommerce' ), - ), + ) ), 'BD' => array( 'postcode' => array( @@ -646,10 +643,7 @@ class WC_Countries { 'CA' => array( 'state' => array( 'label' => __( 'Province', 'woocommerce' ), - ), - 'sortcode' => array( - 'label' => __( 'Bank Transit Number', 'woocommerce' ), - ), + ) ), 'CH' => array( 'postcode_before_city' => true, @@ -732,16 +726,6 @@ class WC_Countries { 'label' => __( 'Province', 'woocommerce' ), ) ), - 'IE' => array( - 'sortcode' => array( - 'label' => __( 'Sort Code', 'woocommerce' ), - ), - ), - 'IN' => array( - 'sortcode' => array( - 'label' => __( 'IFSC', 'woocommerce' ), - ), - ), 'IS' => array( 'postcode_before_city' => true, 'state' => array( @@ -759,10 +743,7 @@ class WC_Countries { 'state' => array( 'required' => true, 'label' => __( 'Province', 'woocommerce' ), - ), - 'sortcode' => array( - 'label' => __( 'Branch Sort', 'woocommerce' ), - ), + ) ), 'JP' => array( 'state' => array( @@ -784,10 +765,7 @@ class WC_Countries { 'NZ' => array( 'state' => array( 'required' => false - ), - 'sortcode' => array( - 'label' => __( 'Bank Code', 'woocommerce' ), - ), + ) ), 'NO' => array( 'postcode_before_city' => true, @@ -850,10 +828,7 @@ class WC_Countries { 'postcode_before_city' => true, 'state' => array( 'required' => false - ), - 'sortcode' => array( - 'label' => __( 'Bank Code', 'woocommerce' ), - ), + ) ), 'TR' => array( 'postcode_before_city' => true, @@ -867,10 +842,7 @@ class WC_Countries { ), 'state' => array( 'label' => __( 'State', 'woocommerce' ), - ), - 'sortcode' => array( - 'label' => __( 'Routing Number', 'woocommerce' ), - ), + ) ), 'GB' => array( 'postcode' => array( @@ -879,10 +851,7 @@ class WC_Countries { 'state' => array( 'label' => __( 'County', 'woocommerce' ), 'required' => false - ), - 'sortcode' => array( - 'label' => __( 'Sort Code', 'woocommerce' ), - ), + ) ), 'VN' => array( 'state' => array( @@ -906,10 +875,7 @@ class WC_Countries { 'ZA' => array( 'state' => array( 'label' => __( 'Province', 'woocommerce' ), - ), - 'sortcode' => array( - 'label' => __( 'Branch Code', 'woocommerce' ), - ), + ) ), 'ZW' => array( 'postcode' => array( @@ -926,9 +892,8 @@ class WC_Countries { $this->locale['default'] = apply_filters('woocommerce_get_country_locale_default', $this->get_default_address_fields() ); // Filter default AND shop base locales to allow overides via a single function. These will be used when changing countries on the checkout - if ( ! isset( $this->locale[ $this->get_base_country() ] ) ) { + if ( ! isset( $this->locale[ $this->get_base_country() ] ) ) $this->locale[ $this->get_base_country() ] = $this->locale['default']; - } $this->locale['default'] = apply_filters( 'woocommerce_get_country_locale_base', $this->locale['default'] ); $this->locale[ $this->get_base_country() ] = apply_filters( 'woocommerce_get_country_locale_base', $this->locale[ $this->get_base_country() ] ); @@ -1010,4 +975,4 @@ class WC_Countries { // Return return $address_fields; } -} +} \ No newline at end of file diff --git a/includes/gateways/bacs/class-wc-gateway-bacs.php b/includes/gateways/bacs/class-wc-gateway-bacs.php index 74e1a39f944..bbfb4fd6240 100644 --- a/includes/gateways/bacs/class-wc-gateway-bacs.php +++ b/includes/gateways/bacs/class-wc-gateway-bacs.php @@ -17,10 +17,14 @@ if ( ! defined( 'ABSPATH' ) ) { */ class WC_Gateway_BACS extends WC_Payment_Gateway { + /** @var array Array of locales */ + public $locale; + /** * Constructor for the gateway. */ public function __construct() { + $this->id = 'bacs'; $this->icon = apply_filters('woocommerce_bacs_icon', ''); $this->has_fields = false; @@ -57,12 +61,14 @@ class WC_Gateway_BACS extends WC_Payment_Gateway { // Customer Emails add_action( 'woocommerce_email_before_order_table', array( $this, 'email_instructions' ), 10, 3 ); + } /** * Initialise Gateway Settings Form Fields */ public function init_form_fields() { + $this->form_fields = array( 'enabled' => array( 'title' => __( 'Enable/Disable', 'woocommerce' ), @@ -95,19 +101,21 @@ class WC_Gateway_BACS extends WC_Payment_Gateway { 'type' => 'account_details' ), ); + } /** * generate_account_details_html function. */ public function generate_account_details_html() { + ob_start(); $country = WC()->countries->get_base_country(); - $locale = WC()->countries->get_country_locale(); + $locale = $this->get_country_locale(); - $sortcode_label = $locale[$country]['sortcode']['label']; - $sortcode = $sortcode_label ? $sortcode_label : __( 'Sort Code', 'woocommerce' ); + // Get sortcode label in the $locale array and use appropriate one + $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort Code', 'woocommerce' ); ?>