Automattic\WooCommerce\StoreApi\Routes\V1

CartItemsByKey::prepare_links()protectedWC 1.0

Prepare links for the request.

Method of the class: CartItemsByKey{}

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.

CartItemsByKey::prepare_links() code WC 9.3.3

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;
}