• Resolved tokyostyle

    (@tokyostyle)


    Hello,

    First of all thanks for creating this great plugin, I’ve been using it for a couple of years already and it saved me a lot of trouble.

    Recently, one of my customers wanted to introduce free delivery for variable minimum order depending on distance. Consider the rules bellow as example:

    if distance = 5km & minimum order > $200 then delivery cost = 0
    if distance = 5km & minimum order < $200 then delivery cost = $10

    Now, the problem is the plugin never shows the free delivery when available. It seems when 2 rules with the same distance are avaialable, the one that has a minimum ammount set is not shown.

    Probably it’s first come first served, but I have no way to manually modify the order of rules and the system auto arrange the rule with minimum ammount after the one with no minimum set, even tho the price is bigger.

    Is there anything that I miss?

    Thank you.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Sofyan Sitorus

    (@sofyansitorus)

    Hi, @tokyostyle,

    Thank you for your feedback. I think it is a bug. Sorry about that. I will try to fix it this weekend.

    Sofyan

    Thread Starter tokyostyle

    (@tokyostyle)

    I think I managed to find sort of a fix for this.

    I edited class-wcsdm-shipping-method.php and put $sorted[‘min_order_amount’] on top and sorted DESC.

    // sort by event_type desc and then title asc.
    array_multisort(
    $sorted[‘min_order_amount’],
    SORT_DESC,
    $sorted[‘max_distance’],
    SORT_ASC,
    $sorted[‘min_order_quantity’],
    SORT_ASC,
    $sorted[‘max_order_quantity’],
    SORT_ASC,
    $sorted[‘max_order_amount’],
    SORT_ASC,
    $filtered
    );

    However, it doesn’t put the desired rule always on top, but with multiple refreshes sometimes it works, and when it works it stays there. :)))

    (Smbd said that doing the same thing again and again and expecting different resoults is the definition of insanity. Well, I did it. I proved that insanity works. Muhahahaha!)

    So yeah, my programming skills is limited, therefore I think it’s best that you come with a much more elegant solution. ??

    Thank you for your help.

    Plugin Author Sofyan Sitorus

    (@sofyansitorus)

    This issue supposes to be solved in version 2.1.5. Please let me know how it works.

    Thread Starter tokyostyle

    (@tokyostyle)

    Sorting works now, great work!

    However there’s a new problem for rules with minimum ammount (possible with quantity too, will check and edit the post):

    If distance checks, but the minimum value does not check, the loop is stucked and doesn’t check the next rule that have same distance but no minimum value.

    • This reply was modified 4 years, 11 months ago by tokyostyle.
    Plugin Author Sofyan Sitorus

    (@sofyansitorus)

    Ah I see, will chek on this.

    Thread Starter tokyostyle

    (@tokyostyle)

    Confirmed same bug for minimum quantity.

    Thread Starter tokyostyle

    (@tokyostyle)

    Btw, do you have a Patreon page so I can offer you a small token of gratitude for your much appreciated work?

    Plugin Author Sofyan Sitorus

    (@sofyansitorus)

    @tokyostyle Unfortunately I don’t have Patreon account. But donation is always welcome via PayPal link below:

    https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DGSVXLV7R8BTY

    Anyway, I just pushed the version update for the fix. Please let me know how it works on your end.

    And thanks for the report.

    Sofyan

    Thread Starter tokyostyle

    (@tokyostyle)

    New version works like a charm, thank you very much!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘0 delivery cost & minimum order ammount’ is closed to new replies.