In a scenario where you are renting products and the time or quantity impact the price, you will need to set up the product page to capture quantity, date, and/or time.
However, this can create an issue on the cart page, since most Shopify themes allow customers to manually change the quantity.
In this article, we’ll go through the steps required to display the quantity instead of allowing it to be edited.
✅ Step 1: Ensure Your Cart Page Supports Line Item Properties
Make sure your cart page is set up for Line Item Properties.
If not, follow Shopify’s official instructions here:
🧩 Step 2: Check for BookThatApp Products
We’re going to check if the current product is known to BookThatApp (BTA).
If it is, we’ll output the quantity (not editable).
If it isn’t, we’ll let the customer change the value as normal.
Locate the input element for quantity, it should look something like this:
<input type="text" name="updates[]" id="updates_{{ item.id }}" value="{{ item.quantity }}" />
✏️ Step 3: Change It to This
Replace that code with the following:
{% if item.product.metafields.bookthatapp.config %}
{{ item.quantity }}
<!-- replace with existing quantity input -->
{% else %}
<!-- replace with existing quantity input -->
{% endif %}✏️ Step 4: Update initial output
You will then want to update the initial input so that it is hidden by adding display: none to the code.
🎉 And that’s it!
💡 Tip: While you are editing the cart page, you may also want to update the header to say “Days” instead of “Quantity.”
Comments
0 comments
Please sign in to leave a comment.