{"title":"CartItems Controller - Liquid Controller Reference","slug":"cart-items-controller-reference","url":"https://support.storeconnect.com/articles/cart-items-controller-reference","url_markdown":"https://support.storeconnect.com/articles/cart-items-controller-reference.md","subtitle":null,"summary":"Intercept the cart item destroy (DELETE) action at `controllers/cart_items/`. Hook into the lifecycle to customize behavior when a customer removes an individual line item from their cart.","type":"Developer_Documentation","video_url":"","keywords":"liquid, controllers, CartItems, storefront, storeconnect","last_modified":"2026-08-21T07:12:35+0000","body_markdown":"## Description\n\nThe CartItems controller handles requests related to cartitems functionality in your StoreConnect storefront.\n\n| Property | Value |\n|----------|-------|\n| **Controller** | `CartItemsController` |\n| **Liquid Template Path** | `controllers/cart_items/` |\n\n## Actions\n\n| Action | HTTP Method | Route | Liquid Page |\n|--------|-------------|-------|-------------|\n| `destroy` | DELETE | `/cart-items/:id` | — |\n\n## Liquid Controller Lifecycle\n\nFor each action, Liquid controller templates are executed in three phases:\n\n1. **Before** — `controllers/cart_items/{action}.liquid` runs before the Rails action\n2. **After** — runs after the Rails action but before the response is sent\n3. **Final** — runs after the response, useful for cleanup\n\n## Available Liquid Tags\n\nInside controller templates, these tags are available:\n\n| Tag | Description |\n|-----|-------------|\n| `{% params %}` | Set request parameters (e.g. `{% params foo: \"bar\" %}`) |\n| `{% variables %}` | Set template variables (e.g. `{% variables title: \"Hello\" %}`) |\n| `{% respond %}` | Respond with custom content, alert, or notice |\n| `{% redirect %}` | Redirect the request (e.g. `{% redirect to: \"/products\" %}`) |\n| `{% action %}` | Execute a server-side action (e.g. `{% action \"cart.add\" %}`) |\n\n## Example\n\nCreate a file at `controllers/cart_items/destroy.liquid`:\n\n\n```liquid\n\n{% before %}\n  variables custom_heading: \"Welcome\"\n{% endbefore %}\n```\n"}