Skip to main content

How to change product quantity

If you need to manage the product quantity inside the configurator, you can use the setQuantity method returned by useZakeke hook , the same will return the quantity property, it corresponds to the product quantities chosen by the customer.

The quantity choice can be enabled or disabled from the product's setting (choose the product on which you want to enable the set quantity, then go in its Composer section, then click on Settings) here in the following screen:

img alt

  • minimum quantity: if left empty the default minimum quantity will be 1;
  • maximum quantity: if left empty there won't be limitations about the number of products added in the same order;
  • step: if left empty there won't be custom step while adding/removing quantities , f.e. if step set as 2, the user will be able to increment the product quantity of 2, 4, 6, ...

Once saved these settings will be recovered from the quantityRule method returned by useZakeke hook, each one respectively as minQuantity, maxQuantity, step;

Let's see an example of how use these methods:

Usage

import { useZakeke } from "zakeke-configurator-react";

const App = () => {
const { quantity, setQuantity, quantityRule, product } = useZakeke();
...
...
return (<>
{product && product.quantityRule && <ProductQuantityContainer>... ...</ProductQuantityContainer>}
</>);
};