• Resolved jlev00

    (@jlev00)


    Hi –

    Upgrading Woocommerce v2.6.4 to v2.6.5 (or above) changes something in Shipping which breaks my site, and I’d like some help regarding how I should be setting things up.

    My General options are:

    Base Location: Australia
    Selling Locations: Sell to specific countries
    Sell to Specific Countries: “Japan”
    Shipping Location(s): Ship to all countries you sell to
    Default Customer Location: no location by default

    In Shipping options, I had one zone “Japan” which ships for 1200 yen flat rate, and “Rest of the World” also set up for 1200 yen flat rate.

    Until 2.6.4 this allowed customers to view the cart and it would display “1200 yen” as the shipping charge regardless of whether they had entered an address or not. However since 2.6.5 the customer receives a message “Shipping costs will be calculated once you have provided your address.”

    Clearly if I’m only shipping to one country and only have one shipping rate this message does not make sense, and until 2.6.4 it was correctly displaying the 1200 yen value from “Rest of the World.” I figure there is a way to configure it but try as I may I cannot work out how. Even deleting the “Japan” zone completely and just having the “Rest of the World” I cannot get it to work.

    I have read the documentation, searched back through support threads, etc. The only success I have had is when I went to the Checkout page, then went back to the cart it seems to have saved my country as “Japan” and therefore gives me a calculation.

    My feeling is that it’s something to do with the “Default Customer Location” being set to none. I tried setting it to Geolocate but I can’t work out how to make this trigger on the Cart page as sometimes it shows “1200 yen” and other times it gives me the “Shipping costs will be calculated once you have provided your address” message.

    Would really appreciate any assistance/direction you could provide. I’m using a theme but have done some limited testing with Twenty-fifteen. Please let me know if you need any further info. Site upgrade is pending sorting this out – thanks!!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter jlev00

    (@jlev00)

    *bump*

    I’m still stuck on 2.6.4 because I can’t figure this out.

    Let me put it another way: what’s the easiest way to have 1) a single flat rate shipping set up for all orders, AND have 2) restrictions on the countries with which I do business, so that a customer doesn’t need to go to the checkout page once in order for the Cart page to show the shipping cost.

    This is almost the simplest type of shipping imaginable yet as far as I can work out it got borked in 2.6.5. There’s a chance I’m just not setting up the Shipping correctly but I can’t work out a combination that doesn’t require a user to go to the Checkout page in order to have the Cart page’s shipping populated.

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    If you have flat rate shipping set up in a single zone, and you want all customers to see this rate from the get go, you need to set their default address to match.

    Is base country not Japan? If not, there are filters to set default address. woocommerce_customer_default_location_array

    Thread Starter jlev00

    (@jlev00)

    Hi Mike – thanks for the reply.

    The base country is Australia; we only ship to Japan (at this stage).

    I tried setting the base country to Japan – Tokyo but still not picking it up.

    Also tried the following:

    add_filter( 'woocommerce_customer_default_location_array', 'set_woocommerce_customer_default_location_array'); 
    
    function set_woocommerce_customer_default_location_array($location) { 
         
        return 'JP'; 
    }; 

    I think its the customer location that’s the issue here. Geolocate is only partially successful as you have found out, so, either the customer location is ambiguous until an address is entered, or you can set the default customer location to the shop base address. Shop base address = Australia, shipping is 1200 yen.

    If you start to sell to other countries with different costs, you’ll be back to either geolocate or calculate after address.

    Thread Starter jlev00

    (@jlev00)

    Hi lorro/Mike – Merry Xmas ??

    Ok it looks like 1) I have completely botched the code above, and 2) there’s something wrong with my Shipping Zones – I can only select “Oceania” but not drill down further to Australia.

    Will have another crack at it and post results in here.

    Also, is anyone able to shed light on what happened in 2.6.5? Was it a complete rewrite of how locations are handled? As I said it is working fine in 2.6.4.

    Thread Starter jlev00

    (@jlev00)

    Hi Mike/lorro –

    The following code seems to be working:

    // Fix Shipping by setting the default customer location to Japan
    add_filter( 'woocommerce_customer_default_location_array', 'set_woocommerce_customer_default_location_array'); 
    
    function set_woocommerce_customer_default_location_array($location) { 
        $location['country'] = 'JP';
        return $location; 
    }; 

    Thanks again for your help – running 2.6.11 in production now.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Flat Rate Shipping to one country only’ is closed to new replies.