Determine if a Cart Has Shippable Items
{exp:cartthrob:has_shippable_items} checks whether the active cart contains at least one shippable product.
See also:
Parameters
This tag has no parameters.
Output
This tag returns a boolean result:
truewhen at least one cart item is backed by a product entry withproduct_shippableset toYes.falsewhen no matching shippable product is found.
When printed directly, the output may appear as a truthy/empty value depending on template rendering. Use conditionals for predictable template logic.
Behavior and Constraints
- Iterates current cart items.
- For each item, loads the related product entry data (if a
product_idexists). - Checks the
product_shippableentry variable. - Returns
trueimmediately on the first product whereproduct_shippable == 'Yes'. - Returns
falseif no matching item is found.
Important nuance:
- This tag checks product-entry shippable flags, not the current shipping total amount.
- Items without a valid product entry are ignored by this check.
Examples
Basic check
{exp:cartthrob:has_shippable_items}
Conditional usage (recommended)
{if '{exp:cartthrob:has_shippable_items}'}
Show shipping address fields
{if:else}
Hide shipping-only fields for digital-only cart
{/if}
Pair with shipping total logic
{if '{exp:cartthrob:has_shippable_items}'}
{if "{exp:cartthrob:has_shipping}" == "TRUE"}
Shipping has been calculated.
{/if}
{/if}