# cart-quantity-validation Function

The cart-quantity-validation Checkout Function runs on Shopify's servers, monitoring updates to a customer's Cart. It's only purposes, are:

* Prevent the customer from updating the quantity of an item from directly within the cart. A customer needs to check availability for the quantity they want from the PRP Rental Widget on the product page. If we didn't prevent quantity updates, a customer could start with a quantity of 1 when looking at the rental availability calendar, then increase it to 10 once they arrive to the cart, essentially bypassing the availability calendar.
* Prevent the customer from removing a Security Deposit product from the cart, whilst the rental product it's connected to is still in the cart.

To enable either of the capabilities above, the Checkout Function must be enabled on your store.

## Enabling the cart-quantity-validation Checkout Function

1. Go to Shopify **Settings > Checkout.**<br>

   <div align="left"><figure><img src="/files/p2vd0ubbRB8qZqyLH1Sv" alt=""><figcaption></figcaption></figure></div>

   &#x20;
2. Scroll down to the bottom and look for the box named **Checkout rules.** Click **Add Rule**.\
   &#x20;
3. A popup will appear with a list of available checkout rules on your store. Click on **cart-quantity-validation** under **PRODUCT RENTALS PRO.**

   <div align="left"><figure><img src="/files/IwKIIMs9Jws5aKROXea7" alt=""><figcaption></figcaption></figure></div>

   &#x20;
4. The rule screen will first ask you to save settings. Leave "allow all customers to complete checkout" ticked and click **Save**. The checkout rule is added.\
   &#x20;
5. Even though the checkout rule has been added, it is not turned on by default. Click **Turn on** at the top right of screen.

   <div align="left"><figure><img src="/files/am2O8ic2rJaY7HNbbN1c" alt=""><figcaption></figcaption></figure></div>

   &#x20;
6. The **On** badge appears next to the title, meaning the Checkout Function is active, and the setup is complete!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.productrentalspro.com/user-guide/other-prp-components/cart-quantity-validation-checkout-function.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
