0

Is it possible to hide all other shipping options( only to show international shipping) in expresso store if the country code is not U.S or Canada?

Has anyone had experience with this?

3 Answers 3

2

To follow up on this using some of the logic Justin explains below I came up with a solution that also updates available shipping methods, shipping cost & order total when either shipping_country or shipping_method dropdowns are changed. http://bit.ly/16x5VOY


$(document).ready(function() {
    $("#shipping_country,#shipping_method").change(function() {
        var url = $(this.form).attr('action');
        var data = $(this.form).serialize();
        $.post(url, data, function() {
            /* Update Method */
            $('#shipping_method').load('/store_example/_update-form #shipping_method');
            /* Update Cost */
            $('.shipping-cost').load('/store_example/_update-form .shipping-cost');
            /* Update Total */
            $('.order-total').load('/store_example/_update-form .order-total');
        });
        return false;
    });
});

Having some trouble getting the AJAX posts to update properly, hopefully someone from store can chime in as there is very little documentation on a practical use of shipping methods. The main problem involves when switching dropdown shipping_country from US > France the shipping_cost & order_total values don't update. If then switch from France > United Kingdom the values do change as expected. This may be more of syntax question, but will definitely help future store users trying to replicate the same functionality.

1
  • I also experienced problems with the .load() method when updating a shipping method element using a snippet or embed; the shipping method drop down did update after changing shipping (or billing) country but the information was incomplete. When I changed to loading a full new copy of the form, and specifying the specific element to update, it worked perfectly. I presume this is because Store.js needs to reload to get all of the context it needs, then the shipping method element you update will contain the full and contextually correct information.
    – 3Easy
    Jul 12, 2014 at 14:25
1

You can create a conditional to check the users shipping location and then show options available. Lets assume from the attached image Shipping Methods

I wanted to have 1 for outside of the US, 5 for Australia and the rest for the US. I could template something along the lines of

<select name="shipping_method">
    <option value="">Select shipping method...</option>
 {if shipping_country != "us" OR shipping_country != "au"}
 <option value="1" selected="selected">World Shipping</option>
 {/if}
 {if shipping_country == "us"}
 <option value="6">FedEx Priority</option>
 <option value="7">UPS</option>
 <option value="8">USPS</option>
 <option value="9">FedEx Slow</option>
 <option value="10">More USPS</option>
 {/if}
 {if shipping_country == "au"}
 <option value="5" selected="selected">Australia Post</option>
 {/if}
</select>

This is something that is going to be addressed in an upcoming release so help streamline this for developers and being able to pull multiple shipping quotes with a single request.

1

When dealing with flat rate shipping for INTL orders, if only there was a select rule called "Any Country Besides [[country value]]". That way, no importing rules for every country.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.