You are here

public function CartCanonicalResource::get in Commerce Cart API 8

GET a collection of the current user's carts.

Parameters

\Drupal\commerce_order\Entity\OrderInterface $commerce_order: The order.

Return value

\Drupal\rest\ResourceResponse The resource response.

File

src/Plugin/rest/resource/CartCanonicalResource.php, line 30

Class

CartCanonicalResource
Provides a cart collection resource for current session.

Namespace

Drupal\commerce_cart_api\Plugin\rest\resource

Code

public function get(OrderInterface $commerce_order) {
  $response = new ResourceResponse($commerce_order);
  $response
    ->addCacheableDependency($commerce_order);
  return $response;
}