Get Live Rates Form

get_live_rates_form works with estimated rates shipping plugins (like UPS). This tag will request one or more estimated rate options from the shipper. Once you receive the estimated costs you will need to use the get_shipping_options tag to output any error messages or returned shipping methods.

Estimated shipping rates is an advanced feature of CartThrob, and is not recommended unless you intend to develop a detailed understanding of your chosen shipping company and their shipping calculations. For instance, UPS will not ship packages larger than 150 lbs, and for overnight shipping they base all shipping rates on package dimensions (called dimensional weight) rather than package weight. Throughout the day they also change available shipping options and prices (morning delivery may not be available for night purchases for example). These details are made clear in the shipper's documentation, but are beyond the scope of the CartThrob documentation itself.

Unless your client has a very specific workflow requiring shipping integration with UPS or other estimated rates shipper, we suggest using standardized threshold pricing and preset shipping methods. You can get very detailed with estimated rates if you wish, but for clients without detailed shipping methodology (when a client just packages items however they see fit) you'll often find a disparity between the estimates and the way the client actually ships packages.

Estimated rate shipping plugins require that you:

  1. Use customer address and cart data to request a shipping estimate from the shipping company.
  2. Based on that estimate, apply the estimated cost to the shipping system.
  3. If customer updates cart; repeat process.

Unlike calculated shipping plugins, estimated plugins require a lot more work from both the template developer and the customer. Also, the required information needed for estimated shipping plugins is much more in depth. To get an accurate price, estimated shipping systems require:

  1. complete address data for the shipper and customer,
  2. package weight
  3. package dimensions (length, width, height)
  4. package type (that conforms to expected values, eg. "FedEx Tube")
  5. shipper location type (residential or commercial)
  6. customer location type (residential or commercial)
  7. user's shipping method
  8. pickup type (daily pickup, counter drop-off, one-time pickup)
  9. number of boxes (not a big deal if it's one per order, or one per item... but what happens when some items go in one box, and others go in another box?)

You can see that there is a lot of required information. It's common for clients to ship with UPS, FedEx, USPS and other services that provide live rate quotes. But, you'll find that generally small companies don't have a clear methodology established for shipping, and don't want to take the time to maintain all of the data required for accurate shipping quotes (like weights and dimensions).

Based on all of these factors, we strongly suggest using an alternate shipping calculation that's simpler for all involved. The customer can still send using UPS or other shipping company, but charging by Weight-Threshold or by total weight, or by location will usually be simpler, cheaper, will save your customer money. Without intense programming on your part, these alternate methods are more flexible and adjustable to the customer's actual out of pocket costs.

Additionally, out of the box, our live rates plugins assume that every item in the cart will ship in one box. Nearly always the client will ship in multiple boxes of varying sizes and shapes, with exceptions for large oversize items, or very small items. If you don't know how to use PHP to modify these live rates to suit your clients shipping methodology, do not attempt to use live rates. These plugins are provided as a scaffolding for building your own live rates system to suit your client's requirements. If you have little experience with PHP, we suggest using out of the box calculated plugins instead.

Table of Contents

Parameters

See Global Form Parameters.

shipping_mode

Options: rate / shop. "rate" will return a single cost based on a specifically requested rate (ground, overnight, 3-day, etc). "shop" will return all available rate options and costs.

shipping_mode="rate"
apply_costs

When used with shipping_mode="rate" this will apply the single estimated rate to the shipping costs. Will not apply any cost when using with shipping_mode="shop".

apply_costs="true"

Variables

shipping_fields

This will output minimum required form code needed to generate an estimate for the estimated rates plugin. This code can be found on the shipping plugin's configuration page as well.

{shipping_fields}

Examples

This example will request an estimated cost from the shipper and apply it to the cart's shipping costs.

{exp:cartthrob:get_live_rates_form
    return = "cart/shipping/complete"
    apply_costs="TRUE"   
    shipping_mode="rate"
    }  
    {shipping_fields}
    <input type="submit" value="Apply Costs">
{/exp:cartthrob:get_live_rates_form}

This example will request all estimated options and costs from the shipper.

{exp:cartthrob:get_live_rates_form
    return = "cart/shipping/choose_shipping_method"
    shipping_mode="shop"
    }  
    {shipping_fields}
    <input type="submit" value="Apply Costs">
{/exp:cartthrob:get_live_rates_form}