Apply discounts to products added to cart if at least one product from 5 collections is in that cart

notice88
New Member
1 0 0

Hi,

I have a Feature in the store where customers can select product per collection that can build their own aquarium. I want to apply discounts customers click add all to cart. I loop all the products selected in Javascript and add them one by one through Ajax like the code below:

 

 jQuery.ajax({
      type: 'POST',
      url: '/cart/add.js',
      data: data,
      dataType: 'json',
      success: function() { 
        window.location.href = '/cart'; 
      }
    });

 

My current issue now is applying discount to the products that was added to cart. 

I have something in my mind like 

Solution 1: Create Shopify Automatic discount, add all the collections needed when building aquarium and set if 5 or more items are in the cart, apply discount. Problem with this approach is customers can only just buy 5 items from one collection. 

Solution 2: Just apply automatic discount to the most expensive collection which is the aquariums then there should be at least 5 items in the caret. The problem with this one is my client wants to apply discounts to multiple products from different collection. 

Solution 3: I don't know if this is possible, can I apply discount on add to cart like passing a discount parameter in the AJAX request?

Let me know other approach I can take or guides I can look through. Apply discounts to products added to cart if at least one product from 5 collections is in that cart

 

 

0 Likes