• Resolved fesarlis

    (@fesarlis)


    Hello, this is a great plugin.

    I have encountered a small issue (imho a bug):

    In my case there are two shipping methods (Local pickup (#1) and Flat Rate (#2)). I have noticed that, when in cart page, and when increasing / decreasing order total (by increasing/decreasing item quantities respectivelly) and the custom threshold set in your plugin’s options is exceeded (or not) by the order total (that is, when your plugin’s message frame appears/disappears), the first shipping method is selected automatically.

    I have to make clear that this issue does not occur until the threshold criterium is met. Steps to reproduce:

    1. Price threshold is 50. Shipping option #2 (Flat Rate) is selected.
    2. Order is < 50 (Frame appears).
    3. Order total is increased by increasing item quantity, but still remains < 50.
    4. Shipping option #2 is still active.
    5. Order total is increased further, and it goes above 50.
    6. Frame disappears (as expected).
    7. Shipping option #1 is selected.

    I hope I’ve been clear enough. Thanks.

    • This topic was modified 3 months, 2 weeks ago by fesarlis.
    • This topic was modified 3 months, 2 weeks ago by fesarlis.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Marin Matosevic

    (@marinmatosevic)

    Hi,

    Thank you for your detailed explanation. I was able to reproduce the issue as you described. However, I want to clarify that our plugin does not directly affect the selection of shipping methods or interfere with them.

    To ensure the behavior isn’t influenced by our plugin, I tested the same scenario with the plugin deactivated, and the result was the same. This suggests that the behavior is related to the appearance of the Free Shipping option rather than our plugin.

    Our plugin includes an option that may be useful for your situation:

    1. Go to the General Settings of our plugin.
    2. Under “Hide shipping rates when free shipping is available?”
    3. Choose “Hide all other shipping methods and only show ‘Free Shipping’ and ‘Local Pickup’.”

    With this setting, Free Shipping will be in the first position and automatically selected once the threshold is reached.

    I hope this helps resolve the issue.

    Thread Starter fesarlis

    (@fesarlis)

    Thank you for your reply. I understand.

    In my case though, the exact opposite behaviour is required. That is, the last selected option to remain active if selected no matter what the order total is. The solution you suggest does not solve the problem because there will be local customers who will definitely want to use local pickup even if the other option s free.

    The reason I created this topic in the first place (or to put it accurately, the reason I noticed this in the first place) is that this issue has immediate side-effects regarding your plugin. For example, and when using mini-cart, your message will not appear at all (even if we increase/decrease total above/below threshold) if local pickup is selected. This is irrational behaviour, because if a customer has reached the cart (and selected local pickup), and then went back to shop, he will add a product, see the mini-cart, and will see NO message regarding free shipping no matter if he is below threshold, because local pickup was previously selected, and even though he has NO INTENTION of using local pickup after finalizing his order. Checking your option ‘Enable on local pickup’ will not exactly solve this because its purpose is different (and of course in my case it is desired to be inactive).

    I don’t know if I make sense ?? Please let me know if you need me to explain more clearly.

    Thanks again.

    • This reply was modified 3 months, 2 weeks ago by fesarlis.
    Plugin Author Marin Matosevic

    (@marinmatosevic)

    I understand and agree with you; displaying the message continuously would enhance the user experience. Enabling “on local pickup” will ensure the progress bar is shown when Local Pickup is selected.

    Regarding your main concern about keeping the selected shipping method after free shipping is enabled, this behavior is inherent to WooCommerce, which defaults to the first available shipping method. I’ve tested this on multiple sites, and the outcome is consistent across all of them. It’s best practice to place the free shipping method first, so it is automatically selected when available. However, on sites using third-party shipping plugins, the selected method often remains unchanged after the free shipping threshold is reached, possibly due to a built-in “woo-fix.”

    You have highlighted a valid point, and we may consider adding an option to allow users to switch this behavior on if needed.

    In the meantime, here is a code snippet that might help:

    add_filter('woocommerce_shipping_chosen_method', function ($method, $available_methods) {
    // Check if a shipping method was selected previously
    if (!empty(WC()->session->get('chosen_shipping_methods'))) {
    $chosen_methods = WC()->session->get('chosen_shipping_methods');
    $chosen_method = $chosen_methods[0];

    // Verify that the previously chosen method is still available
    if (isset($available_methods[$chosen_method])) {
    return $chosen_method;
    }
    }

    // Default to the method passed by the filter if the previously chosen one is not available
    return $method;
    }, 10, 2);
    Thread Starter fesarlis

    (@fesarlis)

    Thanks again.

    Thank you for the snippet, sadly it does not work for me. Its code is clear, so I really don’t know why. Should I try to modify something?

    I am also using a third-party plugin for flat rate/free shipping. I guess it has not incorporated the ‘woo-fix’.

    To provide some more info, I don’t use shipping zones (they make no sense in my case). The ‘capture-all’ zone has only local pickup. The flat rate/free are provided by the third-party plugin.

    Plugin Author Marin Matosevic

    (@marinmatosevic)

    It’s difficult to determine exactly why the snippet isn’t working for you. It might be related to how the third-party shipping plugin adds shipping methods. I recommend experimenting with the priority setting. The default is 10, so try using lower and higher numbers to see if that makes a difference. If the issue persists, reaching out to the plugin’s support team could provide more specific assistance.

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