Automattic\WooCommerce\Internal\RestApi\Routes\V4\Settings\PaymentGateways\Schema

ChequeGatewaySettingsSchema::get_custom_groups_for_gatewayprotectedWC 1.0

Get custom groups for the cheque gateway.

Provides design-aligned labels and descriptions for the check payment settings form fields. Derives fields from the gateway's form_fields to preserve any extension-injected settings.

Method of the class: ChequeGatewaySettingsSchema{}

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.

ChequeGatewaySettingsSchema::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 check payments 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' ),
		),
		// Intentionally differs from BACS/COD ("Order confirmation instructions") per design spec.
		'instructions' => array(
			'label' => __( 'Instructions shown after checkout', 'woocommerce' ),
			'type'  => 'text',
			'desc'  => __( 'Shown on the order confirmation page and in order emails.', 'woocommerce' ),
		),
	);

	$fields = $this->build_fields_from_form_fields( $gateway, $core_field_overrides );

	$group = array(
		'title'       => __( 'Check payment settings', 'woocommerce' ),
		'description' => __( 'Manage how check payments appear at checkout and in order emails.', 'woocommerce' ),
		'order'       => 1,
		'fields'      => $fields,
	);

	return array( 'settings' => $group );
}