I’ve been trying to set my store up in a way that charges my clients an extra $10 whenever they customize products by adding custom text, so I’ve added the following function to my Cart page:
import wixStores from 'wix-stores';
const customization =
[{
name: "Customization fee",
price: 10,
quantity: 1,
note: "Each customized product costs $10 extra!"
},
]
wixStores.addCustomItemsToCart(customization)
.then((updatedCart) => {
const cartId = updatedCart._id
const updatedLineItems = updatedCart.lineItems
})
The problem is, every time I go into the Cart page, the function starts running and their total is increased by 10. So if they buy 1 product, but then enter the Cart page three times, they’ll end up paying for 30 extra.
Also, I haven’t managed to make it so that only custom items receive the added fee, as non-customized items still end up costing extra. Can someone help me out?