Action - Liquid Tag Reference
On this page
The action simple tag triggers a server-side action from within a Liquid controller. Use it to run cart, promotion, and pricebook operations inline, without wrapping content in a block.
Syntax
```liquid
{% action “cart.add”, product_identifier: product.sfid, quantity: 2 %} ```
| Property | Value |
|---|---|
| Tag Name | action |
| Type | Simple tag |
| Source | StoreConnect |
The first argument is the action name. Remaining arguments are named parameters passed to that action. Actions run inside Liquid controllers (the before, after, or final controller positions), not in page templates.
Available actions
| Action | Purpose | Key parameters |
|---|---|---|
cart.select |
Make an existing resumable cart the current cart | cart_identifier |
cart.create |
Create a new empty cart and make it current | — |
cart.clone |
Copy an existing cart’s eligible items into a new cart | cart_identifier |
cart.add |
Add a product to the current cart | product_identifier, quantity, price, override_price |
cart.update |
Change the quantity or price of a cart item | cart_item, quantity, price, override_price |
cart.remove |
Remove a cart item | cart_item |
cart.empty |
Remove all items from the current cart | — |
shipping.set |
Set the shipping name and price on the current cart | name, price |
pricebook.set |
Set the active pricebook for the session | pricebook_id |
pricebook.clear |
Clear the session pricebook | — |
promotion.apply |
Apply a promo code to the current cart | code |
promotion.remove |
Remove a specific promo code | code |
promotion.clear |
Remove all coupon promotions from the cart | — |
cart.clone
Clones an existing cart’s eligible items into a brand-new cart and makes that new cart the current cart. This is useful for re-order flows and quote duplication. Cart cloning is a developer feature, it is not exposed as a button in the default webstore theme.
```liquid
{% action “cart.clone”, cart_identifier: order.cart.sfid %} ```
Requirements
- A logged-in shopper is required. The action reads the current login to set the new cart’s contact and account. If there is no current login, the clone is skipped and an error is added to the session.
- The source cart must belong to the current store. The cart is looked up on the current store by Salesforce ID or SC ID.
Parameters
| Parameter | Required | Description |
|---|---|---|
cart_identifier |
Yes | The Salesforce ID or SC ID of the source cart to clone. |
What gets copied
A new web cart is created against the logged-in shopper’s contact and account, and each eligible item from the source cart is added to it. An item is excluded from the clone when any of the following is true:
- The product is neither purchasable nor quote-requestable.
- There is not enough inventory to cover the item’s quantity.
- The product is bookable (for example, an appointment or class).
- The item is part of a bundle (bundle products are not currently cloned).
Result
- Some or all items copied — the new cart becomes the current cart. Any excluded items are simply left out of the new cart.
- No items could be copied — the action fails, an error is added to the session, and the original current cart is left unchanged.
:::warning When only some items are excluded, the clone still succeeds and the excluded items are omitted silently — the shopper is not automatically shown which items were dropped. If you need to inform the shopper, compare the source cart and the new cart in your Liquid and render your own message. :::
Description
The action tag runs the named server-side operation and updates session state (such as the current cart) accordingly. Errors and warnings raised by an action are added to the session and can be surfaced through your theme’s flash or notice handling.
See Manage multiple carts per customer for the shopper-facing context around cart selection and cloning.
Was this article helpful?
Thanks for your feedback! It helps us improve our docs.