• Resolved aimupwporg

    (@aimupwporg)


    Hello,

    I purchased your plugin today as it provides the order history filtering that I need. However my client just added additional requirement: except of discount on logged users’ order with total spending on previous orders bigger than X, she wants the discount to become invalid if the user purchased anything in the last 6 months. In a way think of it as an dynamically assigned expiration date.

    Can I use some of filtering features to achieve this, or I need to customize the code.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Hermann LAHAMI

    (@mano88)

    So she wants to apply a discount if the total purchased within the last 6 months is more than X?

    Thread Starter aimupwporg

    (@aimupwporg)

    Yes, that’s correct.

    Plugin Author Hermann LAHAMI

    (@mano88)

    You can modify the original source code in woocommerce-all-discounts/includes/class-wad-discount.php line 1709. Looks for this:
    $customer_orders = wad_get_customer_orders();
    There is a loop after that line:

    
    foreach ($customer_orders as $order) {
                            $order = wc_get_order($order->ID);
                            $total_spent+=$order->get_total();
                        }
    

    You’ll need to modify it so the total is only added if the order date is within the last 6 months.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Discount expiration date’ is closed to new replies.