top of page

Minimum Order Quantity: Now Solved with Wix Velo!


MOQ in Wix.

Try out this live example on Wix Minimum Order Quantity


INTRODUCTION

In the world of e-commerce, businesses are always looking for innovative ways to meet the unique needs of their customers. One such game-changing feature is offering customized Minimum Order Quantities (MOQs). However, implementing custom MOQs on a website can be challenging without technical expertise. Luckily, with Wix Velo, the powerful and user-friendly development platform by Wix, solving this challenge becomes much easier. Prepare to unlock a new level of flexibility and cater to your specific quantity supply per customer with Wix Velo's custom MOQs.


To configure customized MOQ to your online store, apply the following code on the cart page of your Wix Stores.


import { cart } from 'wix-stores';
import wixWindow from 'wix-window';
import { getMoq } from "backend/cart.jsw"

$w.onReady(async function () {
  let ProductLessThanMoq = [];
  const cartProduct = await cart.getCurrentCart();
  const lineItems = cartProduct.lineItems;

  await Promise.all(lineItems.map(async (item) => {
    const quantity = item.quantity;
    const itemid = item.productId;
    const moqData = await getMoq(itemid);
    if (quantity < moqData.moq) {
      ProductLessThanMoq.push(item); 
      console.log(item, `because it is less than moq ${moqData.moq - quantity}`);
      wixWindow.openLightbox("LightBox",ProductLessThanMoq)
    } else if (quantity >= moqData.moq) {
      console.log(`You can go to checkout because it is equal to your MOQ which is ${moqData.moq}`);
    } else {
      console.log("You can go to checkout");
    }
  }));
});

With this simple process, configuring customized MOQ is made easier and hassle-free. Troubleshoot issues if the code isn't implemented.

For further assistance, Hire a Certified Velo Developer



bottom of page