WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
How to make free shipping the only option after a set amount? (20 posts)

  1. brashell
    Member
    Posted 1 year ago #

    On my site there is flat rate and free shipping option. When under 50 dollars there is only flat rate, when over 50 you get free shipping. Customers keep clicking the flat rate though, even though there is free shipping (when there order is over 50). Then I have to refund the order and its a nightmare. How can I make it so when there order is over 50 dollars the only option they have is free shipping and the flat rate button disappears? Where do I need to put the code? What is the code? I had someone do it for me with an older version, but since then, he well, died.... Thanks for the help - B

    http://wordpress.org/extend/plugins/woocommerce/

  2. brashell
    Member
    Posted 1 year ago #

    BTW it is the newest version of woo

  3. dontforgetmario
    Member
    Posted 1 year ago #

    I think this extensions can solve your free shipping problem:

    http://www.woothemes.com/products/table-rate-shipping-2/

    http://www.woothemes.com/products/per-product-shipping/

    If you need any help...

    Cheers
    Mario

  4. RyanWheaton
    Member
    Posted 1 year ago #

    do you know if the Per Product Shipping interferes with an already running UPS calculator? THanks!

  5. thecookiemonster
    Member
    Posted 1 year ago #

    Yo brashell, i searched for the same answer not too long ago and only came up with a solution after i purchased the table rate pluggin...

    I found the solution in the woodoc's pages some where. the quick and nasty is to add the following to your functions.php file.
    Works a treat.

    // Hide standard shipping option when free shipping is available
    add_filter( 'woocommerce_available_shipping_methods', 'hide_standard_shipping_when_free_is_available' , 10, 1 );
    
    /**
     *  Hide Standard Shipping option when free shipping is available
     *
     * @param array $available_methods
     */
    function hide_standard_shipping_when_free_is_available( $available_methods ) {
    
        if( isset( $available_methods['free_shipping'] ) AND isset( $available_methods['flat_rate'] ) ) {
    
            // remove standard shipping option
            unset( $available_methods['flat_rate'] );
        }
    
        return $available_methods;
    }
  6. brashell
    Member
    Posted 1 year ago #

    @thecookiemonster does it work with the new woo commerce?

  7. thecookiemonster
    Member
    Posted 1 year ago #

    I have not upgraded yet, my site is still in Dev. but no reason why it shouldnt work though.
    Worth a try, give it a bash!

  8. thecookiemonster
    Member
    Posted 1 year ago #

    Just tested after upgrade to Woo 203. Works A-ok!

  9. brashell
    Member
    Posted 1 year ago #

    what do I put the code in? The theme functions.php? or does woo commerce have one?

  10. thecookiemonster
    Member
    Posted 1 year ago #

    Copy n paste it into your Themes functions.php file

  11. brashell
    Member
    Posted 1 year ago #

    10,1 what is that?

  12. brashell
    Member
    Posted 1 year ago #

    NVM, Dude your freakin awesome, saved me 50 bucks paying some dude to do it. You program WordPress?

  13. Roy
    Member
    Posted 1 year ago #

    10 is the priority and 1 means 1 argument being passed.

  14. brashell
    Member
    Posted 1 year ago #

    ah, ok. TY

  15. thecookiemonster
    Member
    Posted 1 year ago #

    Glad to be of help.
    Spent hours looking for that fix....after i spent the 50 bucks on the pluggin.

  16. jasepo
    Member
    Posted 7 months ago #

    Hey,

    and there is a bug, however, if you adjust the cart (delete a few items to drop below the minimum amount), the free shipping option will stay there even if that is at the updated cart no longer valid :(

  17. uattah
    Member
    Posted 6 months ago #

    Hi all-
    This is the only thread I could find that remotely resembles the issue I am having.

    I have flat rate shipping per item and free shipping for all orders above $49. Regardless of whether or not an order is below or above $49, the free shipping option appears. So someone checking out with $20 can choose the flat rate OR the free shipping option at checkout. This is CLEARLY not what I want.

    Does anyone know of a way to make the 'free shipping' option NOT appear when an order is below $49? Any help would be greatly appreciated!

    I tried the code another user posted above and it didn't work for me.

  18. bridieamelia
    Member
    Posted 5 months ago #

    @uattah, have just used the very same code and it worked a treat. Are you putting the code in the correct place? (your theme's functions.php, preferably a child theme)

  19. arianasu
    Member
    Posted 4 months ago #

    @bridiemelia. How do I put it in my child theme functions.php? I know how to get into my functions.php folder in my child theme but i dont know if i am ment to keep the parent themes coding and just paste it underneith or do i delete all that and then paste it in or do i need to add something extra. Ive tried so many ways and none are working. It worked before when i just pasted it underneath in the parent themes functions.php but my site crashed when i added another code a few days later so i made my child one and don't want to risk it again. Please help...Thanks :)

  20. arianasu
    Member
    Posted 4 months ago #

    Its ok I found out how to do it. For other newbies...once you have made your child theme create a folder within that using your text editor named functions.php and add the code below with <?php at top line. (I dont know if you need to add the extra parts above and below the code every time you add a new function or if the functions always get added within the existing ones as this is the first function i have added to my child theme).

    <?php

    /* custom PHP functions below this line */
    // Hide standard shipping option when free shipping is available
    add_filter( 'woocommerce_available_shipping_methods', 'hide_standard_shipping_when_free_is_available' , 10, 1 );

    /**
    * Hide Standard Shipping option when free shipping is available
    *
    * @param array $available_methods
    */
    function hide_standard_shipping_when_free_is_available( $available_methods ) {

    if( isset( $available_methods['free_shipping'] ) AND isset( $available_methods['flat_rate'] ) ) {

    // remove standard shipping option
    unset( $available_methods['flat_rate'] );
    }

    return $available_methods;
    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags