International Shipping Price Increase?

RodeoRamseyRodeoRamsey Member
in General edited July 2012
I have a client who's shipping is pretty basic: Anything under $100 is $5.95. Anything over $100 is Free. I have the following script for that. However, when she gets an order from Australia (and I suppose any non-US based shipping address), her cost is higher. She would like me to change Australia to be $16.95 and potentially additional countries may be different as well. How would I modify the following code to reflect that:
    /* BEGIN CUSTOM SHIPPING LOGIC */
 
 if (fc_json.total_price < 100) {
addShippingOption(1, 5.95, 'USPS', '');
} else {
addShippingOption(1, 0, '', 'Free Shipping');
}
 
    /* END CUSTOM SHIPPING LOGIC */

Or is there someplace else I need to add this logic? Thanks.
Tagged:
Comments
  • sparkwebsparkweb Member, Integration Developer, FoxyShop, Order Desk
    This is a good place to start: http://wiki.foxycart.com/snippets/shipping/flat_rates_by_country_and_product_category
    /* BEGIN CUSTOM SHIPPING LOGIC */
    
    var country_code = (jQuery("#use_different_addresses").is(":checked") ? $("#shipping_country").val() : $("#customer_country").val());
    
    //AU
    if (country_code == "AU") {
    	addShippingOption(1, 16.95, 'USPS', '');
    
    //US
    } else {
    	if (fc_json.total_price < 100) {
    		addShippingOption(1, 5.95, 'USPS', '');
    	} else {
    		addShippingOption(1, 0, '', 'Free Shipping');
    	}
     }
    
    /* END CUSTOM SHIPPING LOGIC */
    
  • fc_adamfc_adam FoxyCart Team
    @RodeoRamsey,

    Actually it you take a look at the docs page for Multiple Flat Rates, example 2 talks about checking based on country codes: http://wiki.foxycart.com/snippets/shipping/multiple_flat_rates
  • Ok, so if I want to change it to the following format:
    U.S. stays the same
    Canada $12.95 USPS Flat Rate Shipping
    All other countries $16.95 USPS Flat Rate Shipping


    I would want the following:
    /* BEGIN CUSTOM SHIPPING LOGIC */
     
    var country_code = (jQuery("#use_different_addresses").is(":checked") ? $("#shipping_country").val() : $("#customer_country").val());
    
    //CAN
    if (country_code == "CAN") {
    	addShippingOption(1, 12.95, 'USPS', '');
    
    //AU
    if (country_code == "AU") {
    	addShippingOption(1, 16.95, 'USPS', '');
     
    //US
    } else {
    	if (fc_json.total_price < 100) {
    		addShippingOption(1, 5.95, 'USPS', '');
    	} else {
    		addShippingOption(1, 0, '', 'Free Shipping');
    	}
     }
     
    /* END CUSTOM SHIPPING LOGIC */
    

    ???
  • fc_adamfc_adam FoxyCart Team
    Not quite, that will end up with pricing for Canada, Australia and everything else would be the US pricing.

    I'd make it this:
    /* BEGIN CUSTOM SHIPPING LOGIC */
     
    var country_code = (jQuery("#use_different_addresses").is(":checked") ? $("#shipping_country").val() : $("#customer_country").val());
     
    if (country_code == "US") {
    // US
    	if (fc_json.total_price < 100) {
    		addShippingOption(1, 5.95, 'USPS', '');
    	} else {
    		addShippingOption(1, 0, '', 'Free Shipping');
    	}
    } else if (country_code == "CA") {
    // CAN
    	addShippingOption(1, 12.95, 'USPS', '');
    } else {
    // ELSEWHERE
    	addShippingOption(1, 16.95, 'USPS', '');
    }
     
    /* END CUSTOM SHIPPING LOGIC */
    
  • Thanks Adam!!!! :)
Sign In or Register to comment.