In a scenario where you are renting products and the time or quantity impact the price you will set up the product page to capture quantity, date and/or time. However, this creates a problem on the cart page because most themes allow you to change the quantity. In this article I'm going to describe the steps required to show the quantity instead.
Step 1. You should make sure your cart page is set up for Line Item Properties. Follow the instruction on the Shopify to set it up if required: https://community.shopify.com/c/shopify-design/product-pages-get-customization-information-for-products/td-p/616503
Step 2. We are going to check if the current product is known to BookThatApp and if so then output the quantity, otherwise we will let the user change the value as per normal. Locate the input element for quantity. It should look like this:
<input type="text" name="updates[]" id="updates_{{ item.id }}" value="{{ item.quantity }}" />
Change it to this:
{% if item.product.metafields.bookthatapp.config %}
{{ item.quantity }}
{% else %}
<input type="text" name="updates[]" id="updates_{{ item.id }}" value="{{ item.quantity }}" />
{% endif %}
And that is it.
Tip: While you are editing the cart page, you may want to update the header to say "Days" instead of "Quantity".
Comments
0 comments
Please sign in to leave a comment.