Automattic\WooCommerce\Blocks\BlockTypes\ProductCollection

Controller::register_settingspublicWC 1.0

Exposes settings used by the Product Collection block when manipulating the default query.

Method of the class: Controller{}

No Hooks.

Returns

null. Nothing (null).

Usage

$Controller = new Controller();
$Controller->register_settings();

Controller::register_settings() code WC 9.9.3

public function register_settings() {
	register_setting(
		'options',
		'woocommerce_default_catalog_orderby',
		array(
			'type'         => 'object',
			'description'  => __( 'How should products be sorted in the catalog by default?', 'woocommerce' ),
			'label'        => __( 'Default product sorting', 'woocommerce' ),
			'show_in_rest' => array(
				'name'   => 'woocommerce_default_catalog_orderby',
				'schema' => array(
					'type' => 'string',
					'enum' => array( 'menu_order', 'popularity', 'rating', 'date', 'price', 'price-desc' ),
				),
			),
			'default'      => 'menu_order',
		)
	);
}