Is In Cart
{exp:cartthrob:is_in_cart} checks whether a cart contains an item with a specific entry_id.
You can use it as a single tag or as a tag pair.
See also:
Parameters
entry_id
Entry ID of the product to check.
entry_id="123"
Output and Behavior
entry_idis required to perform the check.- The check matches cart items by
entry_id. - Single-tag output is truthy when a match is found (
"1"in template comparisons), otherwise empty/false. - In tag-pair mode, both
{is_in_cart}and{item_in_cart}are available as equivalent booleans.
Examples
Single-tag conditional
{if '{exp:cartthrob:is_in_cart entry_id="{segment_3}"}' == "1"}
This item is already in your cart!
{/if}
Tag-pair conditional
{exp:cartthrob:is_in_cart entry_id="123"}
{if is_in_cart}
This item is already in your cart!
{/if}
{/exp:cartthrob:is_in_cart}