• Resolved dpm21

    (@dpm21)


    Hello,

    I am writing to you because I am experiencing an issue using your plugin alongside another specific plugin.

    I am using the plugin called “WooCommerce Advanced Free Shipping” because I have specific products that I do not want to be included in the free shipping option. In your plugin’s general settings, I selected my “Initial Shipping Zone”, which is “France Métropolitaine”. However, I deactivated the “Free Shipping” method in the WooCommerce settings, as it only allows me to set simple requirements such as a promo code or a minimum order amount.

    That is why I rely on “WooCommerce Advanced Free Shipping”, which enables me to exclude certain products (such as heavy items) from the free shipping option.

    My question is: Is it possible for your plugin to work with the information specified in the “WooCommerce Advanced Free Shipping” plugin?

    Unfortunately, I am unable to attach screenshots to illustrate the issue more clearly.

    Thank you for your help.

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Marin Matosevic

    (@marinmatosevic)

    Hi,

    Our plugin is fully compatible with WooCommerce Advanced Free Shipping. Could you clarify the exact issue you’re experiencing? For example, is the progress bar not displaying correctly, or is free shipping showing when it shouldn’t (or vice versa)?

    Additionally, please make sure to enable the “Allow zero shipping cost” option in the Progress Bar settings. This setting ensures that free shipping provided by the AFS plugin is correctly recognized.

    Thread Starter dpm21

    (@dpm21)

    Hello,

    thank you for coming back to me.

    The bar is displaying but free shipping is validated for some products that should not be include in the free shipping condition. I enabled the option you told me, but it still not working.

    Regards

    Plugin Author Marin Matosevic

    (@marinmatosevic)

    Have you enabled the Custom Threshold option in our plugin, or is it pulling free shipping information directly from Advanced Free Shipping?

    Also, do you have complex free shipping conditions? Are the products that should be excluded part of a specific category or tag? If so, I can provide you with a code snippet to exclude products from a certain category or tag from free shipping.

    Thread Starter dpm21

    (@dpm21)

    I had to “Enable Custim Threshold” in order for the bar to appear in my cart yes. If this option is “off”, the progress bar doesn’t appear.

    Yes, the condition for having free shipping is to order at least 90€, and some products are not eligible (products such as heavy products, gift box…). Some of them are registred in a specific category (gift box) but some of them not.

    Thank you

    Plugin Author Marin Matosevic

    (@marinmatosevic)

    Maybe the best approach would be to add tags to those products that should be excluded from free shipping. That way, we can check the cart for product tag slugs and prevent the progress bar from appearing if those products are in the cart.

    Here’s a code snippet that does this by checking for specific product tags and disabling free shipping if they are present. Add code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Avoid adding custom code directly to your parent theme’s functions.php file as this will be wiped entirely when you update the theme.

    add_filter('fsl_min_amount', function ($amount) {

    if (!WC()->cart) {
    return;
    }

    // Define the product tags to exclude from free shipping.
    $excluded_tags = [
    'exclude-tag-1',
    'exclude-tag-2',
    ];

    $taxonomy = 'product_tag';

    foreach (WC()->cart->get_cart() as $cart_item_key => $cart_item) {

    // Check if the product belongs to any of the excluded tags.
    if (has_term($excluded_tags, $taxonomy, $cart_item['product_id'])) {
    // Set the amount to null and exit the loop.
    $amount = null;
    break;
    }
    }

    return $amount;
    });

    You just need to replace 'exclude-tag-1' and 'exclude-tag-2' with the actual tag slugs you assign to those products.

    Thread Starter dpm21

    (@dpm21)

    It works ! Thank you for that !

    But I noticed that even tho on your plugin’s general settings, I mentionned “Intial shipping zone : France Métropolitaine”, the progress bar appears even if the customer choose a shipping to “Luxembourg” which is not included in the free shipping condition.

    is there anything I can add to the code you sent me earlier ?

    Plugin Author Marin Matosevic

    (@marinmatosevic)

    Yes, we can modify the code to ensure the progress bar only appears for your initial shipping zone. Here’s the updated version:

    add_filter('fsl_min_amount', function ($amount) {

    if (!WC()->cart) {
    return;
    }

    $initial_zone_id = DEVNET_FSL_OPTIONS['general']['initial_zone'] ?? 1;

    $shipping_packages = WC()->cart->get_shipping_packages();
    $shipping_zone = wc_get_shipping_zone(reset($shipping_packages));
    $zone_id = $shipping_zone->get_id();

    if ($zone_id !== $initial_zone_id) {
    return null;
    }

    // Define the product tags to exclude from free shipping.
    $excluded_tags = [
    'exclude-tag-1',
    'exclude-tag-2',
    ];

    $taxonomy = 'product_tag';

    foreach (WC()->cart->get_cart() as $cart_item_key => $cart_item) {

    // Check if the product belongs to any of the excluded tags.
    if (has_term($excluded_tags, $taxonomy, $cart_item['product_id'])) {
    // Set the amount to null and exit the loop.
    $amount = null;
    break;
    }
    }

    return $amount;
    });

    Thread Starter dpm21

    (@dpm21)

    Hello Marin,

    Do I have to specify something in this part of the code :

     $initial_zone_id = DEVNET_FSL_OPTIONS['general']['initial_zone'] ?? 1;

    Because, the code you sent me doesn’t work even tho i specified the product tag. When I check my cart, the progress bar doesn’t appear anymore now.

    Thank you

    Plugin Author Marin Matosevic

    (@marinmatosevic)

    No, you don’t need to change anything in that part of the code. The code automatically checks the initial shipping zone set in the general settings and disables the progress bar if the customer’s selected zone isn’t the same as the initial zone. If the zone matches, then it performs an additional check on the product tags.

    To troubleshoot further, could you please share:

    1. A link to your website.
    2. The name of one product with an excluded tag and one that should pass the free shipping condition.
    3. The shipping details (e.g., postal code or other specific input) that will place me in the France Métropolitaine zone.
    Thread Starter dpm21

    (@dpm21)

    Yes sure:

    Thank you

    Plugin Author Marin Matosevic

    (@marinmatosevic)

    Thank you for providing the details. I see what might be causing the issue. Please update the code with the corrected part below:

    $initial_zone_id = (int)(DEVNET_FSL_OPTIONS['general']['initial_zone'] ?? 1);

    This ensures the initial zone ID is properly interpreted as an integer, which could have been the source of the issue.

    Thread Starter dpm21

    (@dpm21)

    Thank you very much for your help, it works !

    Plugin Author Marin Matosevic

    (@marinmatosevic)

    Great! I’m glad I could help. 🙂

    In the upcoming release, we’ll include full support for the Advanced Free Shipping plugin, so you won’t need the custom code anymore. If you decide to leave it, no harm done—it just won’t be necessary, as all custom conditions will be read directly from the Advanced Free Shipping plugin.

    P.S. If you’re enjoying the plugin, we’d really appreciate it if you could take a moment to leave a review. Your feedback means a lot to us. Thank you!

    Best regards

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