WC_Gateway_BACS::__construct()publicWC 1.0

Constructor for the gateway.

Method of the class: WC_Gateway_BACS{}

Hooks from the method

Return

null. Nothing (null).

Usage

$WC_Gateway_BACS = new WC_Gateway_BACS();
$WC_Gateway_BACS->__construct();

WC_Gateway_BACS::__construct() code WC 8.6.1

public function __construct() {

	$this->id                 = 'bacs';
	$this->icon               = apply_filters( 'woocommerce_bacs_icon', '' );
	$this->has_fields         = false;
	$this->method_title       = __( 'Direct bank transfer', 'woocommerce' );
	$this->method_description = __( 'Take payments in person via BACS. More commonly known as direct bank/wire transfer.', 'woocommerce' );

	// Load the settings.
	$this->init_form_fields();
	$this->init_settings();

	// Define user set variables.
	$this->title        = $this->get_option( 'title' );
	$this->description  = $this->get_option( 'description' );
	$this->instructions = $this->get_option( 'instructions' );

	// BACS account fields shown on the thanks page and in emails.
	$this->account_details = get_option(
		'woocommerce_bacs_accounts',
		array(
			array(
				'account_name'   => $this->get_option( 'account_name' ),
				'account_number' => $this->get_option( 'account_number' ),
				'sort_code'      => $this->get_option( 'sort_code' ),
				'bank_name'      => $this->get_option( 'bank_name' ),
				'iban'           => $this->get_option( 'iban' ),
				'bic'            => $this->get_option( 'bic' ),
			),
		)
	);

	// Actions.
	add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
	add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'save_account_details' ) );
	add_action( 'woocommerce_thankyou_bacs', array( $this, 'thankyou_page' ) );

	// Customer Emails.
	add_action( 'woocommerce_email_before_order_table', array( $this, 'email_instructions' ), 10, 3 );
}