Flat Rate Shipping for Australian States and Country Regions

flatrate-polaMy delving into Instinct’s WP E-Commerce plugin for WordPress has raised a few questions and now that I have had some spare time I’ve prepared some Visser-style hacks and solutions!

I recently raised in Hot Aussie Topics for WP E-Commerce that there was no shipping calculator supporting flat-rate shipping for Australian states which were manageable within the WordPress Administration and selectable by customers at checkout, well here’s my fix.

  • Login to WordPress Adminstrator
  • Under General Settings set the Base Country/Region to Australia and save changes
  • Using your favourite FTP manager navigate to /wp-content/plugins/wp-e-commerce/shipping/... and with your preferred text editor open flatrate.php
  • Ensure you have an original copy of flatrate.php stored on your computer.
  • On line #39 paste the following…
    case 'AU':
    $output .= "<tr class='rate_row'><td>Australian Capital Territory</td><td>$<input type='text' size='4' name='shipping[au-act]' value='{$shipping['au-act']}'></td></tr>";
    $output .= "<tr class='rate_row'><td>New South Wales</td><td>$<input type='text' size='4' name='shipping[au-nsw]' value='{$shipping['au-nsw']}'></td></tr>";
    $output .= "<tr class='rate_row'><td>Northern Territory</td><td>$<input type='text' size='4' name='shipping[au-nt]' value='{$shipping['au-nt']}'></td></tr>";
    $output .= "<tr class='rate_row'><td>Queensland</td><td>$<input type='text' size='4' name='shipping[au-qld]' value='{$shipping['au-qld']}'></td></tr>";
    $output .= "<tr class='rate_row'><td>South Australia</td><td>$<input type='text' size='4' name='shipping[au-sa]' value='{$shipping['au-sa']}'></td></tr>";
    $output .= "<tr class='rate_row'><td>Tasmania</td><td>$<input type='text' size='4' name='shipping[au-tas]' value='{$shipping['au-tas']}'></td></tr>";
    $output .= "<tr class='rate_row'><td>Victoria</td><td>$<input type='text' size='4' name='shipping[au-vic]' value='{$shipping['au-vic']}'></td></tr>";
    $output .= "<tr class='rate_row'><td>Western Australia</td><td>$<input type='text' size='4' name='shipping[au-wa]' value='{$shipping['au-wa']}'></td></tr>";
    break;
  • On what was line #54 replace the following with my updated version:
    Original: if (get_option('base_country')=='NZ') {
    Updated: if (get_option('base_country')=='NZ' || get_option('base_country') == 'AU') {
  • On what was line #92 add in the following between the NZ and US ‘case’ entries:
    case 'AU':
    $shipping_quotes["Australian Capital Territory"] = (float)$flatrates['au-act'];
    $shipping_quotes["New South Wales"] = (float)$flatrates['au-nsw'];
    $shipping_quotes["Northern Territory"] = (float)$flatrates['au-nt'];
    $shipping_quotes["Queensland"] = (float)$flatrates['au-qld'];
    $shipping_quotes["South Australia"] = (float)$flatrates['au-sa'];
    $shipping_quotes["Tasmania"] = (float)$flatrates['au-tas'];
    $shipping_quotes["Victoria"] = (float)$flatrates['au-vic'];
    $shipping_quotes["Western Australia"] = (float)$flatrates['au-wa'];
    break;
  • Save changes and upload the updated flatrate.php to your web server.
  • Within WordPress Administrator open General Settings and switch to the Shipping tab
  • Select Flat Rate under Internal Shipping Calculators and save changes
  • Hover over the Flat Rate checkbox and click on Edit
  • Under Flat Rate in the right column of the Shipping tab fill in your fixed rate pricing for each Australian state
  • Click Update to save changes

That’s it, you’ve just hooked up flat rate pricing for Australian customers! Now jump on the front-end and test to ensure that when Australia is set from the drop-down that your prices are coming up. We’re all learning here so if there’s any problems let me know in the comments or send me an e-mail for personal assistance.

Leave a Comment

Before you comment - Do you have a support request? If so, this is not the right place to post it. Please submit support requests for Premium Plugins on the Support page and in the community Support Forums for free Plugins.

Your email address will not be published. Required fields are marked *