Automattic\WooCommerce\StoreApi\Routes\V1

CartItems::prepare_links()protectedWC 1.0

Prepare links for the request.

Method of the class: CartItems{}

No Hooks.

Return

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->prepare_links( $cart_item, $request );
$cart_item(array) (required)
Object to prepare.
$request(\WP_REST_Request) (required)
Request object.

CartItems::prepare_links() code WC 8.6.1

protected function prepare_links( $cart_item, $request ) {
	$base  = $this->get_namespace() . $this->get_path();
	$links = array(
		'self'       => array(
			'href' => rest_url( trailingslashit( $base ) . $cart_item['key'] ),
		),
		'collection' => array(
			'href' => rest_url( $base ),
		),
	);
	return $links;
}