In an e-commerce website, a client has a special requirement for adding gift products to a cart.
While adding to a cart, if the product price is greater than 150, the cart should be split with the same products, each having a maximum 150 price.
For example, if the actual price of the product is 400, then 3 products should be added to the cart with prices of 150,150,100 respectively.
The task was challenging. It was not just setting calculation logic. It was much more complex to implement.
Simply adding the product to the cart 3 times in a loop did not work. I had to work with many files, have to divide the price in one file and apply it to the others.
When things started working on the minicart, they didn't work on the cart page.
When things worked on the cart page, they didn't work on the checkout page.
When everything appeared to be working properly, it was not working in the live environment.
Everything had to be solved, and it was challenging.
According to the client, this task can't be done by their 3 previous developers. I have done it.
I’ve released a 100% open-source Next.js + Shopify template with a retro look and the essentials to start building: product collections, variant selection, a shopping cart, and responsive layouts.
Run it with the included demo catalog, make it your own, then connect your Shopify store for live commerce.
Built with Next.js, React, TypeScript, and Tailwind CSS. Free under the MIT license and ready to download and customize.