register_settings( aiou()->settings() ); ( new Feature() )->register(); } /** * Register the "WooCommerce" tab and its "Country States" section. * * @param SettingsRegistry $settings The settings registry. * @return void */ private function register_settings( SettingsRegistry $settings ): void { $settings->add_tab( self::TAB, __( 'WooCommerce', 'all-in-one-utilities' ), __( 'Small fixes for WooCommerce stores. Shown only while WooCommerce is active.', 'all-in-one-utilities' ), 95 ); $settings->add_section( self::TAB, self::SECTION, __( 'Country States', 'all-in-one-utilities' ), __( 'WooCommerce has no state or province list for many countries, so customers there type it by hand. This adds the missing lists.', 'all-in-one-utilities' ), 10 ); $settings->add_field( self::TAB, self::SECTION, new Field( id: 'enabled', label: __( 'Add missing states', 'all-in-one-utilities' ), type: 'checkbox', default: 0, args: array( 'toggle_label' => __( 'Show a state/province dropdown at checkout and in addresses for countries WooCommerce has no list for', 'all-in-one-utilities' ) ), doc: new Doc( title: __( 'Missing states', 'all-in-one-utilities' ), short: __( 'Adds states or provinces for countries such as Afghanistan, Saudi Arabia, the United Arab Emirates, and Russia. Customers pick from a list instead of typing, so shipping zones and tax rates by state work for those countries too.', 'all-in-one-utilities' ), detailed: __( 'Only countries WooCommerce has no list for are changed. If a later WooCommerce version adds its own list for one of them, WooCommerce\'s list is used instead.', 'all-in-one-utilities' ), warnings: array( __( 'Orders already placed keep the region text the customer typed.', 'all-in-one-utilities' ) ) ), priority: 10 ) ); $settings->add_field( self::TAB, self::SECTION, new Field( id: 'required', label: __( 'Make the state required', 'all-in-one-utilities' ), type: 'checkbox', default: 0, args: array( 'toggle_label' => __( 'Customers in these countries must pick a state before they can check out', 'all-in-one-utilities' ), 'depends_on' => 'enabled', ), priority: 20 ) ); } }