• Hello,

    I’m using discount based on payment gateway option from Booster for Woocommerce and I’ve just set shipping zones with free shipping for orders above certain amount. I noticed that the shipping cost is being calculated before the discount. Is it possible to calculate shipping cost after the discount?

    https://wordpress.org/plugins/woocommerce/

Viewing 15 replies - 1 through 15 (of 20 total)
  • Plugin Contributor Claudio Sanches

    (@claudiosanches)

    Better you check if the author of Booster for Woocommerce.

    Thread Starter taysabr

    (@taysabr)

    As I didn’t have any reply from Booster plugin support and I haven’t solve my problem yet, I’d like to ask something about a snippet that I got. It should supposedly hide woocommerce free shipping option when total (not subtotal) is under the woocommerce minimum amount (excluding the discount applied by the payment gateway then). The thing is that the snippet is not doing what it’s suppose to do, so I’d like to know what could be wrong with it. Thank you

    /**
    * @snippet Hide free shipping if under minimum amount
    */
    add_filter( ‘woocommerce_package_rates’, hide_free_shipping, 10, 2 );
    function hide_free_shipping($rates, $package) {

    // Get Min Amount from Woo Settings
    $free_shipping_settings = get_option( ‘woocommerce_free_shipping_settings’ );
    $min_amount = $free_shipping_settings[‘min_amount’];

    // Get Cart Total
    $current = WC()->cart->cart_contents_total;

    // If Total < Min Amount hide free shipping
    if ( $current < $min_amount ) {
    unset( $rates[‘free_shipping’] );
    }
    return $rates;
    }

    Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    Hey taysabr,

    That snippet will only work before WooCommerce 2.6. It needs to be adapted to work with the new shipping zones, similar to this snippet: https://mikejolley.com/2016/06/17/woocommerce-hide-shipping-rates-when-free-shipping-is-available/

    If you aren’t sure how to do this, then you can find some help from a developer at one of these sources:

    http://jobs.wordpress.net/
    https://codeable.io/

    Thread Starter taysabr

    (@taysabr)

    Thanks for your reply Caleb.

    If somebody already has the snippet adaption to new woocommerce 2.6 and could share, I would appreciate!

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    The ‘free_shipping’ will just be named something, e.g. free_shipping:instance_id. You could var_Dump() the array to see what code is there if you need to find out the ID.

    Thread Starter taysabr

    (@taysabr)

    Hi Mike!
    I’m glad for your reply, but I’m not a coder, so unfortunately I can’t understand what you mean.
    I can’t find any plugin that could calculate the discount before the shipping costs calculation, so I think it’s an issue related to woocommerce, isn’t it?
    Thanks again!

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    ^ caleb suggested some resources for hiring devs if you want something custom.

    What is the instance ID for your flat rate shipping https://dl.dropboxusercontent.com/s/1a3vkub4lypumt9/2016-06-22%20at%2015.25.png?dl=0

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    Sorry, free shipping.

    Thread Starter taysabr

    (@taysabr)

    Ok Mike, thank you very much!!

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    Did you find it?

    Thread Starter taysabr

    (@taysabr)

    Yes Mike, I have two shipping zones that are using free shipping, the id’s are 1 and 4, but I’m not sure what to do with them.

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    In your snippet, change ‘free_shipping’ to ‘free_shipping:1’

    Thread Starter taysabr

    (@taysabr)

    That one inside the brackets, right? It didn’t work 🙁

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    Wait a minute, that snippet is pointless. The free shipping method itself has an option to set min amount.

    Thread Starter taysabr

    (@taysabr)

    Yes, free shipping has an option to set minimun amount. It happens that woocommerce shipping calculation is based on “subtotal” (I think). And the snippet is based on “cart_contents_total”. I’m just looking for something that can calculate shipping cost considering a discount applied on payment gateway (what woocommerce is not doing itself).
    Ex: minimun amount to get free shipping is set to $250
    Subtotal is $275
    Payment gateway discount: – 25.7
    Total: $247.5
    It shouldn’t show free shipping in this case, but it does.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘Shipping cost after the discount’ is closed to new replies.