Show a block only for specific products
In short
Open the block, turn on Enable conditional block visibility and add a Product in cart condition with your products. The block then shows only when at least one of them is in the cart.
✓ Applies to
- Advanced and Deluxe plans
- Any Checkout Ninja block, in any checkout position
- Products, variants, product types and vendors
✕ Doesn't apply to
- Hiding a single block type inside a block. Conditions apply to the whole block
- Hiding payment methods or changing the cart. Use checkout rules for that
Before you start
- Create and save your block. How.
Steps
Turn on visibility rules
Open the block. In the Block Visibility card, turn on Enable conditional block visibility. Click Add new visibility condition.
Pick the products
Choose Product in cart. Under Product, select one or more products.
Save
Click Save.
Other product conditions
| Condition | Shows when |
|---|---|
| Product not in cart | None of them is in the cart |
| Variant in cart / not in cart | A chosen variant is / isn’t in the cart |
| Product quantity in cart | Total quantity meets your number |
| Product type in cart / not in cart | That exact product type is / isn’t there |
| Vendor Name in cart / not in cart | That exact vendor is / isn’t there |
Several conditions on one block work as OR. You can’t require two to match at once.
Check it works
- Checkout with a chosen product: the block shows.
- Swap it for another product: the block hides.
Good to know
- Product type and vendor must match exactly, capitals included. One value per condition.
- There’s no collection condition. Use products, a product type or a vendor.
- Different content per product? Make one block per product.
Not working?
- Shows for every cart: check visibility is on and saved, and no “not in cart” condition is matching.
- Never shows: the Product field is empty, or type/vendor spelling is off.
- Quantity doesn’t match: pick an operator (not ”-”) and a whole number.
Frequently asked
If I select several products, do they all have to be in the cart? +
No. Product in cart matches when any one of the selected products is in the cart. Product not in cart matches only when none of them are.
Can I show the block when product A is in the cart AND the buyer is in a certain country? +
Not with one block. When a block has several conditions, it shows as soon as any one of them matches. Conditions are combined with OR, not AND.
Can I show the block only when a buyer has 2 or more of a product? +
Yes. Use Product quantity in cart, select the product, choose Greater Than or Equal, and enter 2. Quantities are added up across all variants of all selected products.
Does Product type in cart ignore upper and lower case? +
No. Product type and vendor names must match exactly, including capital letters, as they're written in your Shopify admin.