Hi im looking to add a Low in Stock when an item hits 2 units. Ive seen the code but i have no experience in coding, i wondered if anyone would be able to help me.
Hi @kustomfigz , you can learn Velo with these resources: https://www.wix.com/velo/forum/getting-started/resources-to-learn-velo
the original code is:
import wixLocation from 'wix-location';
$w.onReady(function () {
trackProductInventory();
wixLocation.onChange(() => {
trackProductInventory();
})
});
async function trackProductInventory() {
const product = await $w('#productPage').getProduct();
const productQuantity = product.quantityInStock;
if (product.inStock && productQuantity <= 10) {
$w('#stockNotification').show();
} else {
$w('#stockNotification').hide();
}
}
You can change this line from
if (product.inStock && productQuantity <= 10) {
to
if (product.inStock && productQuantity <= 2) {
So the case will be equal to or less than 2 stock unit.
P.S. Please do not directly copy the code as it may not work as expected. You can advise doing some modification based on your needs. - This forum is for learning, there won’t be any do-it-for-you-for-free services
Thank you for your quick response, yeah i understand that i need to do it myself : ) just hard when had no experience. But thank you so much
Hope you can find some success with Velo!
Btw,
If you are having difficulty with the code, you might want to consider looking for help on the Wix Marketplace , an online marketplace with top Velo web developers from around the world.