Automattic\WooCommerce\Admin\API\AI

Product::register_routes()publicWC 1.0

Register routes.

Метод класса: Product{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$Product = new Product();
$Product->register_routes();

Код Product::register_routes() WC 9.7.1

public function register_routes() {
	$this->register(
		array(
			array(
				'methods'             => \WP_REST_Server::CREATABLE,
				'callback'            => array( $this, 'update_product' ),
				'permission_callback' => array( Middleware::class, 'is_authorized' ),
				'args'                => array(
					'products_information' => array(
						'description' => __( 'Data generated by AI for updating dummy products.', 'woocommerce' ),
						'type'        => 'object',
					),
					'last_product'         => array(
						'description' => __( 'Whether the product being updated is the last one in the loop', 'woocommerce' ),
						'type'        => 'boolean',
					),
				),
			),
		)
	);
}