WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
How to add option to upgrade shipping? (13 posts)

  1. Dunc
    Member
    Posted 1 year ago #

    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

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

  2. bheadrick
    Member
    Posted 1 year ago #

    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.

  3. Dunc
    Member
    Posted 1 year ago #

    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!

    Cheers.

  4. bheadrick
    Member
    Posted 1 year ago #

    plugins/woocommerce/classes/shipping/class-wc-flat-rate.php

  5. Dunc
    Member
    Posted 1 year ago #

    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 :)

  6. bheadrick
    Member
    Posted 1 year ago #

    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 {
  7. bheadrick
    Member
    Posted 1 year ago #

    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.

  8. liontreestudios
    Member
    Posted 5 months ago #

    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:

    http://liontreestudios.co.uk/plugins/extrashipping.zip

  9. dazaccheo
    Member
    Posted 5 months ago #

    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).

  10. -OZ-
    Member
    Posted 5 months ago #

    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.

  11. liontreestudios
    Member
    Posted 5 months ago #

    Hi Dazaccheo, exactly what functionality are you looking for?

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

    http://liontreestudios.co.uk/plugins/extrashipping2.zip

    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.

  12. -OZ-
    Member
    Posted 5 months ago #

    Thanks exactly what I needed!

  13. dazaccheo
    Member
    Posted 5 months ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic