Repository Forums Support WooCommerce Extended Coupon Features PRO cheapest_product / every_nth_item query

Topic Resolution: Resolved
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1627
    Jonathan Moore
    Participant

    what is the best way to implement the following requirement, eg: any 5 products, cheapest goes free

    I didn’t get the results I expected from testing:

    1. _wjecf_apply_discount_to = every_nth_item

    Set up as follows:
    _wjecf_apply_discount_to = every_nth_item
    % discount = 100
    minimum quantity = 5
    a category filter was applied and all the basket items tested match this category

    Testing with basket gives:
    Basket:
    4 x €165.44
    1 x €19.38
    3 x €10.85
    Discount applied is -€19.38
    Expected discount should be -€10.85

    Basket:
    4 x €165.44
    3 x €19.38
    3 x €10.85
    Discount applied is -€30.23 (-€19.38 -€10.85)
    Expected discount should be -€21.70 (2x -€10.85)

    It appears the calculation is working from the top down, starting with the most expensive and discounting the cheapest of the most expensive and then the next…
    The desired behaviour would be get the total number of matching items and discount the cheapest or to work from the bottom up.

    2) _wjecf_apply_discount_to = cheapest_product

    I also tried:
    _wjecf_apply_discount_to = cheapest_product
    % discount = 100
    minimum quantity = 5
    but in this case, according to my testing no discount is ever applied, even when increasing individual line items to 5 or more items.

    #1630
    Soft79
    Keymaster

    It is like this by design for the following reason:

    1) Let’s say the customer has 5 products in cart of $100 each. The discount is $100. Cart total is $400

    2) Now the customer adds 1 product worth $20. If we use your method and discount the cheapest item, the cart total would become $500.

    This means adding a cheap ($20) 6th item increases the cart total with the price of a more expensive product ($100). I.e. the customer would get a worse deal if adding the 6th item. In other words: the customer is penalized for adding more products to the cart.

    #1633
    Jonathan Moore
    Participant

    hmmm… yes the customer should get a worse deal if they add a cheap product

    your point 2 is a desirable behaviour and common sales strategy: when cheapest is free, the customer knows that it is not a great advantage to add cheap item so they may upgrade to more expensive item to get the most benefit from the offer.

    If the customer can get expensive item free just by adding cheap item, there is no upsell value. Giving away expensive item when cheap item is added sounds very bad from the shop owner’s view, and the sales tools are not supposed to make a loss for the shop.
    In your example the shop owner has to give away a $100 item when a $20 item is added, that doesn’t sound good business.

    Apart from this discussion in the context of every_nth_item, what about cheapest_product, what is needed to make the cheapest_product option work? – I couldn’t get that to apply in any circumstance and I couldn’t find any more detail in the documentation.

    #1634
    Soft79
    Keymaster

    I see, cheapest Item fails in combination with a percent discount on WC3.0+

    If you need a quick fix, please open wp-content/plugins/woocommerce-auto-added-coupons-pro/includes/pro/WJECF_Pro_Limit_Discount_Quantities.php and find this line (around 182):

    if ( ! $wrap_coupon->is_type( array( 'fixed_product', 'percent_product' ) ) ) {

    replace it with:

    if ( $wrap_coupon->is_type( WJECF_WC->wc_get_cart_coupon_types() ) ) {

    If you prefer not to change it yourself, I will place the new beta version online later today.

    #1641
    Jonathan Moore
    Participant

    hmmm that gives PHP Parse error: syntax error, unexpected ‘->’ (T_OBJECT_OPERATOR)

    Probably it should be:

    
    if ( $wrap_coupon->is_type( WJECF_WC()->wc_get_cart_coupon_types() ) ) {
    

    that seems to work well.

    #1643
    Soft79
    Keymaster

    Oh, yeah sorry for the typo.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.