How to make Coupon code(amount) and gift certificates work only for a certain part of the order value


  • Default avatar
    david19    
     2 years ago  last edited 2 years ago
    0

    Greetings!

    I just purchased the Awocoupon PRO and would like to know if there is a way to make coupon codes and gift certificates work only for a certain part of the order summ? Same thing goes for balance of the user, that have activated gift certificates?

    For example i have a gift certificate that gives 100$ discount to order value. If customer add to cart products worth 50$ and apply gift certificate - total order value would be 0$, but I want the coupon to apply maximum for half of the order(for example). So after applying the gift certificate - total order value should be not 0$, but 25$

    I think that would be a very useful function. Thank you for answer!

  • Your avatar
    seyi    
     2 years ago
    0

    Hello,

    Interesting idea, unfortunately there is not such a function.
  • Default avatar
    david19    
     2 years ago
    0

    Will there be such a function in the future or how can i solve this issue myself?
  • Your avatar
    seyi    
     2 years ago
    0

    The issue here is multiple coupons.  If you have multiple coupons enabled and you use 2 different coupons:
    - discount 50% of order max
    - discount 25% of order max

    Not sure how to handle that.

    Also there is the 'maximum discount amount' option, would that work?
  • Default avatar
    david19    
     2 years ago  last edited 2 years ago
    0

    In the field "maximum discount amount", you can enter only the amount, not a percentage of the order sum. Besides, gift certificates with a maximum discount amount and other restrictions, for example, for certain categories - can not be added to the client balance. So gift certificates that were added to client balance would work without restrictions. I need to apply client balance only for certain categories of products and maximum for the 50% of the sums of the value of certain products.

    I guess this issue could be solved by changing the program code and adding certain balance application algorithm. In what file the algorithm for applying the vaucher is realised?

  • Your avatar
    seyi    
     2 years ago
    0

    In the file awocoupon/library/class-awocoupon-library-discount.php
  • Default avatar
    david19    
     2 years ago  last edited 2 years ago
    0

    Thank you. I will try to realise somehow the condition "if the final order discount > 50% of order sum without discount - then make final discount as 50% of order sum" while applying client voucher balance.


    (Edit) That's not so easy, that i thought, to realise for client balance with lots of gift certificates activated in balance. As i understand, private function checkdiscount_giftcert() works several time until it uses balance as much as possible.

    For example client activated gift1(10$), gift2(5$), gift3(2$). The balance is 17$. He add to cart products worth 16$ and apply the voucher_balance. The awocoupon first of all will apply the gift1 certificate, finding minimum between 16$ and 10$. The minimum is 10 - so applying 10$ discount. In next step it will find the minimum between the remaining order amount (6$) and the second gift2 (5$). The minimum is 5$ - so add one more discount to order. In third step finding the minimum between the remaining order amount (1$) and the third gift3 (2$). The minimum is 1$ - adding to discount.

    So i broke my head thinking about how I can limit the amount of applied discounts to half of the order value.

  • Default avatar
    david19    
     2 years ago
    0

    The problem was solved by adding 2 more variables to (Process discount: giftcert) and a condition, that checks at each step the sum of all issued discounts and the discount being prepared for application, and if that sum is > 0.5*order_total - then make the "discount being prepared" less then 0.5*order_total.