WC_REST_Products_Catalog_Controller::register_routes
Register the routes for products catalog.
Method of the class: WC_REST_Products_Catalog_Controller{}
No Hooks.
Returns
null. Nothing (null).
Usage
$WC_REST_Products_Catalog_Controller = new WC_REST_Products_Catalog_Controller(); $WC_REST_Products_Catalog_Controller->register_routes();
WC_REST_Products_Catalog_Controller::register_routes() WC REST Products Catalog Controller::register routes code WC 10.4.3
public function register_routes() {
register_rest_route(
$this->namespace,
'/' . $this->rest_base,
array(
array(
'methods' => WP_REST_Server::CREATABLE,
'callback' => array( $this, 'request_catalog' ),
'permission_callback' => array( $this, 'request_catalog_permissions_check' ),
'args' => array(
'fields' => array(
'description' => __( 'Product/variation fields to include in the catalog. Can be an array or comma-separated string.', 'woocommerce' ),
'type' => array( 'array', 'string' ),
'items' => array( 'type' => 'string' ),
'required' => true,
'validate_callback' => array( $this, 'validate_fields_arg' ),
'sanitize_callback' => array( $this, 'sanitize_fields_arg' ),
),
'force_generate' => array(
'description' => __( 'Whether to generate a new catalog file regardless of whether a catalog file already exists.', 'woocommerce' ),
'type' => 'boolean',
'default' => false,
'sanitize_callback' => 'rest_sanitize_boolean',
),
),
),
'schema' => array( $this, 'catalog_schema' ),
)
);
}