Support » Plugin: WooCommerce » How to add option to upgrade shipping?

  • Hi All

    I’m using Woocommerce with the Emporium theme. Not used Woocommerce before but like what I’m seeing, struggling with odds & ends though 🙂

    I’ve got 4 shipping classes set up (small, standard, ¼ Pallet, Full Pallet) and have set the associated costs with each for UK Flat Rate Shipping Method.

    That’s fine, but what I’d like to be able to do is to add an option to upgrade to 24hr priority delivery.

    The problem I have is that it’s not a fixed amount to upgrade, nor is it a fixed percentage, the upgrade for ‘small’ goes from £5 to £8 for example whereas the Fill Pallet goes from £40 to £50 for example.

    Any ideas on how I can best achieve this would be very much appreciated!! (If I can avoid having to pay out for the table rate plugin then that’d be great!)

    Regards – Duncan

Viewing 12 replies - 1 through 12 (of 12 total)
  • there’s no simple way to do it.
    Basically, you need a second instance of the flat rate shipping method.

    I’ve done something similar for one shop to implement “free shipping” with a tiered handling charge which is based on the subtotal.

    What I did is I copied the flat rate shipping class into a separate plugin and renamed everything that referenced “flat rate shipping”

    There might be a more efficient way to do it, but definitely not a simpler one.

    Thanks for that, much appreciated.

    I like your idea of a second instance of flat rate though, that would work nicely. Would you mind giving me a quick pointer as to where I can find the existing flat rate shipping class code? I had a quick look round but it wasn’t jumping out at me – probably too tired and looked right through it!

    An idiots guide would be lovely if you’ve got the time!



    Thanks Bryan – I was looking in completely the wrong place 🙂

    A little more guidance if I could presume upon your goodwill!

    Is it simply a matter of doing the edits & ftping a renamed file into that classes folder? I’ve tried that & Woo didn’t pick up that there was another shipping class.

    I’ve also tried putting the file into a folder, zipping it & uploading as if a normal plugin and again no joy…

    It’s possible I’ve made a daft code error but thought I’d best ask the question whilst I’m in learning mode 🙂

    no, you don’t want to put anything into the woocommerce folder.

    You need copy this file into the plugins folder and initialize it as a separate plugin. THe top of the file should look something like this:

     Plugin Name: Woocommerce Expedited Shipping
     * A simple shipping method for a flat fee per item or per order
     * @class 		WC_Flat_Rate
     * @version		1.6.4
     * @package		WooCommerce/Classes/Shipping
     * @author 		WooThemes
    global $woocommerce;
    if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
    add_action('plugins_loaded', 'init_woocommerce_expedited_shipping', 0);
    function init_woocommerce_expedited_shipping() {
    class WC_Expedited_Shipping extends WC_Shipping_Method {

    I just uploaded my “flat rate shipping with dynamic handling” plugin as an example. It’s a little gutted, but if you compare it to the original WC_FLAT_RATE class, you should be able to see what changes you need to get the functionality you want.

    I spent all afternoon struggling with this one. I needed two different shipping rates whereby the first one added £2.50 for the first item then £1 after that and the 2nd one needed to add £5 for the first item and £2.50 after that. I wasn’t going to pay $100 for table shipping when I only needed a tiny bit of the code so I did what bheadrick did and created a plugin for an extra flat rate shipping option.

    You can download it below and install it like a normal plugin, thought it might be helpful to someone else:

    I want to thank you, liontreestudios. I installed your plugin and it works great. It is just what I was looking for to add a registered mail option You are a lifesaver for those of us who do not understand code or scripting (not sure what it is called).

    Thanks Liontreestudios, your plugin is really helping me. I was wondering if it were possible to add more flat rates (I need 4 total). I’ve been tinkering with modified copies of yours but I always end up with a fatal error preventing their activation.

    Hi Dazaccheo, exactly what functionality are you looking for?

    OZ, I needed similar functionality so I created another shipping option plugin:

    Basically if you find each function that has a _2 behind it and change them to _3 (and then _4). It is a bit messy but you will end up with 4 different ones.

    Thanks exactly what I needed!

    It is working great for me. The only thing I would like if possible is on my free shipping option. On orders over $75 I offer free regular shipping. As I used your plugin to add a registered mail option, I would like the free shipping to offer the upgraded option difference which is $4. I hope this makes sense.

    On orders under $75 I have flat rate shipping of $6 and now the optional upgrade I added with your plugin which is registered mail for $10.

    On orders over $75 I would like there to be free shipping regular mail or if they choose registered, the cost to them to be $4.

    Not sure if this is possible.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘How to add option to upgrade shipping?’ is closed to new replies.