5

We're integrating exp-resso store with a new e-commerce site. Ideally, we want to be very clear about the shipping charges for an order on the cart page before we have a lot of information from the customer (where they live, for example). I understand that some of this is required to determine the rate. With other e-commerce packages we've worked with there is a Shipping Calculator feature which prompts the visitor for their city, state, and zip and then presents them with the shipping rates that apply to their order. Can we do this with exp-resso store?

  • To answer this question, we'd need to know how you currently have shipping set up. Which service are you using for shipping? Are you getting live shipping quotes? – Anna_MediaGirl Nov 26 '12 at 20:29
  • Right now we're using the Default Shipping Plugin but we'll likely be moving to either the UPS or FedEx plugin shortly. – ShawnCBerg Nov 26 '12 at 20:41
8

The easiest way to do this would be to have the following in your template somewhere for the default shipping plugin:

{exp:store:checkout}
<label>Shipping Country</label>
{field:shipping_country}

<label>Shipping State</label>
{field:shipping_region}

<input type="submit" name="update_cart" value="Update Shipping" class="btn" />
{/exp:store:checkout}

You would want to change that to:

{exp:store:checkout}
<label>Shipping Country</label>
{field:shipping_country}

<label>Shipping Zip</label>
{field:shipping_postcode}

<input type="submit" name="update_cart" value="Update Shipping" class="btn" />
{/exp:store:checkout}

If you are using FedEx/USPS/UPS plugins.

There are a few things to mention though so you don't get weird behavior. In the Store >> Settings >> Genereal page you will want to make sure that the "Default Shipping Address" field is set to either "None" or "Billing Address same as Shipping" if you have "Shipping Address same as Billing" you will need to change the fields to {field:billing_country}, {field:billing_region}, and {field:billing_postcode} respectively so that Store will calculate your shipping cost.

  • Great solution, Justin! Works great, and I appreciate the explanation. – ShawnCBerg Nov 27 '12 at 3:19
  • No problem Shawn as @MediaGirl said it would be very easy to submit that portion of the your template via AJAX so that you don't need to refresh the page to grab the rates – Justin Long Nov 27 '12 at 4:47
8

This shouldn't be hard to set up on your end, I'm sure there isn't code offhand to send you.

I'd set up the form prompting for city, state, and zip on my Cart page... then submit form using ajax to get the data into the session, then call a template which contains your shipping code using ajax into your page.


EDIT

Use the {exp:store:checkout} on your cart page to collect your shipping city, state and zip data. https://exp-resso.com/docs/store/tags/checkout.html

Submit that form using ajax.

In the second template, use the same {exp:store:checkout} tag to display the available shipping methods: https://exp-resso.com/docs/store/tags/checkout.html#shipping-methods

You will return this template's data with ajax after the first form is submitted.

If you don't want to use ajax, just return the form to the same page and show the shipping methods as needed.

  • 2
    Spot on. The Default Shipping Plugin only really needs your state/country, and UPS/FedEx only usually need a ZIP and Country. – Adrian Macneil Nov 26 '12 at 21:41
  • Seems easy enough! Is there any documentation on these form variable names and the post URL? I wasn't aware we could do this, but that's definitely a good solution once I know the form variable names and post URL. Thanks so much! – ShawnCBerg Nov 26 '12 at 21:50
  • 2
    Excellent solution @MediaGirl - will be using this on a future build. – Mutual Nov 26 '12 at 22:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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