WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\StoreApi\Routes

Products::prepare_links() protected WC 1.0

Prepare links for the request.

{} It's a method of the class: Products{}

No Hooks.

Return

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->prepare_links( $item, $request );
$item(\WC_Product) (required)
Product object.
$request(\WP_REST_Request) (required)
Request object.

Code of Products::prepare_links() WC 5.8.0

protected function prepare_links( $item, $request ) {
	$links = array(
		'self'       => array(
			'href' => rest_url( $this->get_namespace() . $this->get_path() . '/' . $item->get_id() ),
		),
		'collection' => array(
			'href' => rest_url( $this->get_namespace() . $this->get_path() ),
		),
	);

	if ( $item->get_parent_id() ) {
		$links['up'] = array(
			'href' => rest_url( $this->get_namespace() . $this->get_path() . '/' . $item->get_parent_id() ),
		);
	}

	return $links;
}