Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Trying to create a bundle with product variants A,B,C, D and E where A is the main volume driver. Accessories B,C,D and E are added to the bundle in a non-linear fashion.
For background, we sell tiles by sqm. The accessories are glue (B), grout (C), sealant fluid (D) and cleaning products(E).
If a customer chooses a tile (A) a bundle of all accessories in a required amount should be included. To exemplify:
The accessory B is sufficient for up to 4 sqm tile (A). The accessory C is sufficient for up to 20 sqm tile (A). The accessory D is sufficient for up to 15 sqm tile (A). The accessory E is sufficient for up to 100 sqm tile (A).
We would like to create a function where by a customer enters the quantity sqm of A, and the function adds the minimum required quantity of each accessory B,C,D and E.
For example: A customer ordering 22 sqm of a tile format A, the bundle would be made up of 22 sqm A, 6 units of B (22/4 rounded up to closest integer), 2 units of C (22/20), 2 units of D and 1 unit of E (22/100).
If and only if the minimum of the required accessories volumes is met, the product A would be discounted. If not met, then no discount. However if more than the minimum required accessories volume is added of any of the accessories the discount still applies.
Any ideas?
Hi @Denbu ,
Your logic can be used to increase the quantity of additional items, when they choose but discount not.