Overview
This customization hides the quantity input (including the plus and minus buttons) for specific product variants in the cart. This ensures those products can only be purchased in fixed quantities. This is helpful for free gifts, subscription boxes, or limited-edition items. This method uses Shopify variant IDs (not product IDs), so you can target specific variants directly.Step 1: Find the variant ID
- In Shopify Admin, go to Products
- Click the product you want to modify
- In the Variants section, select the variant you want to lock
- Look at the URL in your browser — the variant ID appears after
/variants/
36485954240671
Step 2:
- Go to Upcart > Cart Editor > Settings > Custom CSS
- Paste the following code into the input area, replacing the example variant ID with your own:
Add custom CSS in V1.0
Add custom CSS in V2.0
Important notes
- Make sure there is exactly one space between the selectors:
.upcart-product-item[id*='...']and[class*="styles_QuantityField__"] - Repeat the rule for each variant you want to target by using its unique ID
Result
- Customers still see the product in their cart
- The quantity cannot be adjusted
- The product remains locked to the quantity added initially (for example, 1 unit for a free gift)
- Free gifts
- Promotional samples
- One-per-customer product rules

