Automattic\WooCommerce\Internal\RestApi\Routes\V4\Settings\PaymentGateways\Schema
BacsGatewaySettingsSchema::get_custom_groups_for_gateway
Get custom groups for the BACS gateway.
Provides design-aligned labels and descriptions, and separates account details into its own group. Derives fields from the gateway's form_fields to preserve any extension-injected settings.
Method of the class: BacsGatewaySettingsSchema{}
No Hooks.
Returns
Array. Custom group structure.
Usage
// protected - for code of main (parent) or child class $result = $this->get_custom_groups_for_gateway( $gateway ): array;
- $gateway(WC_Payment_Gateway) (required)
- Gateway instance.
BacsGatewaySettingsSchema::get_custom_groups_for_gateway() BacsGatewaySettingsSchema::get custom groups for gateway code WC 10.8.1
protected function get_custom_groups_for_gateway( WC_Payment_Gateway $gateway ): array {
// Design-aligned overrides for core fields.
$core_field_overrides = array(
'enabled' => array(
'label' => __( 'Enable/Disable', 'woocommerce' ),
'type' => 'checkbox',
'desc' => __( 'Enable Direct bank transfer at checkout', 'woocommerce' ),
),
'title' => array(
'label' => __( 'Checkout label', 'woocommerce' ),
'type' => 'text',
'desc' => __( 'Shown to customers on the payment methods list at checkout.', 'woocommerce' ),
),
'description' => array(
'label' => __( 'Checkout instructions', 'woocommerce' ),
'type' => 'text',
'desc' => __( 'Shown below the checkout label.', 'woocommerce' ),
),
'order' => array(
'label' => __( 'Order', 'woocommerce' ),
'type' => 'number',
'desc' => __( 'Determines the display order of payment gateways during checkout.', 'woocommerce' ),
),
'instructions' => array(
'label' => __( 'Order confirmation instructions', 'woocommerce' ),
'type' => 'text',
'desc' => __( 'Shown on the order confirmation page and in order emails.', 'woocommerce' ),
),
);
// account_details is handled in a separate group, skip it in the main fields.
$fields = $this->build_fields_from_form_fields( $gateway, $core_field_overrides, array( 'account_details' ) );
$settings_group = array(
'title' => __( 'Direct bank transfer settings', 'woocommerce' ),
'description' => __( 'Manage how Direct bank transfer appears at checkout and in order emails.', 'woocommerce' ),
'order' => 1,
'fields' => $fields,
);
$field = $gateway->form_fields['account_details'] ?? array();
$account_details_group = array(
'title' => __( 'Bank account details', 'woocommerce' ),
'description' => __( 'Manage the bank accounts customers can use to pay by bank transfer.', 'woocommerce' ),
'order' => 2,
'fields' => array(
array(
'id' => 'account_details',
'label' => $field['title'] ?? __( 'Account details', 'woocommerce' ),
'type' => 'array',
'desc' => $field['description'] ?? __( 'Bank account details for direct bank transfer.', 'woocommerce' ),
),
),
);
return array(
'settings' => $settings_group,
'account_details' => $account_details_group,
);
}