WordPress.org

Support

Support » Plugins and Hacks » Free Shipping Rules Based on Role

Free Shipping Rules Based on Role

  • I am wondering if anyone could point me in the right direction here. I am looking for a solution to this problem. Woocommerce offers an option to allow free shipping if the order is above a certain amount. I need to make this option a different amount for different kinds of user roles i.e wholesale and regular customer. I am figuring a custom snippet should get the job done, but I am not sure of the hook I need to be using to accomplish this task. I am thinking about using a filter so that IF the user role is wholesale then replace the variable used for the amount with the new number. Any help would be appreciated.

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

Viewing 15 replies - 1 through 15 (of 23 total)
  • danbrady
    Participant

    @danbrady

    Did you get this sorted? I’m looking for the same thing.

    Yes I did…I created a ticket with woothemes support and they walked me through the code I needed to add to my functions.php file. I have not implemented yet so I am not 100% sure it will work. I do not want to post the code here, but would be happy to share via email, or pm.

    danbrady
    Participant

    @danbrady

    Thanks, that would be great. If you have a transcript of the walkthrough and code, could you please email: dan.brady [at] me.com

    Much appreciated 🙂

    danbrady
    Participant

    @danbrady

    It worked for us, with minor mods to suit our client’s requirements, thanks again

    nyxerus
    Member

    @nyxerus

    This is exactly what I have been banging my head against the wall for. Any chance you guys could help me out? I need to provide free shipping to certain user roles. Any help would be appreciated. thanks.

    danbrady
    Participant

    @danbrady

    @crazyk73 – I don’t see any reason not to post the code here?

    I’ll leave it with you 🙂

    nyxerus
    Member

    @nyxerus

    Ya i would definitely appreciate it. If you prefer not to post it in here, please feel free to email me at gabriel [at] boley.me

    Thanks!

    crazyk73
    Member

    @crazyk73

    I will be more than happy to send the code to any other members if they need it. Just post here with your email.

    jeanne38654
    Member

    @jeanne38654

    I’d like the code! [email removed]

    Thank you very much!!

    lsl923
    Member

    @lsl923

    Can I please get the code – [email address moderated – these forums do not provide support via email]

    Thank you!

    WPyogi
    Forum Moderator

    @wpyogi

    These forums do not provide email support – and we do not recommend posting emails here.

    @crazyk73 – please post that to a pastebin for anyone else to download.

    WPyogi
    Forum Moderator

    @wpyogi

    danbrady
    Participant

    @danbrady

    A few people are emailing me for the code, so I am putting it here. But the disclaimer first – we amended the code supplied by woothemes (via crazyk73). This worked for our site and our specific requirements – make sure you test thoroughly for your site and needs.

    If you want the shortcut, quick option, purchase: the role-based-payment-shipping-methods extension/

    Alternatively, try this (note that we are giving free shipping to users of the role ‘wholesale buyer’ plus a couple of conditions which you will definitely want to change):

    In the theme’s functions.php file, in the main class:

    add_filter( 'woocommerce_available_shipping_methods', array( &$this, 'woocommerce_set_free_shipping_for_certain_users' ));

    And add this:
    http://pastebin.com/i4vLvggn


    In case it wasn’t clear – you need to modify this to fit your requirements

    I’ve just tried to use this latest snippet and just to let you know it’s been depracated. You can use a play on the following code in the Woothemes documentation:

    http://docs.woothemes.com/document/hide-other-shipping-methods-when-free-shipping-is-available/

    I just put together a little example to give free shipping to replace the last example by @danbrady which no longer works.

    WordPress snippet – WooCommerce free shipping by role

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘Free Shipping Rules Based on Role’ is closed to new replies.