Sorry! Internet Explorer is not supported on this site. Please view on Chrome, Firefox, or Edge.

Having fun at Zao is one of our values. We’ve put limited animated flourishes throughout our site to communicate our love of levity. We also recognize that onscreen movement is not fun or possible for everyone. We've turned off all our animations for you per your browser's request to limit motion. That said, we don't want you to miss out on the party.

Here's a funny joke to enjoy!

What do you get when you cross a dyslexic, an insomniac, and an agnostic?

Someone who lays awake at night wondering if there is a dog.

How To: Remove Shipping Calculator from WP eCommerce

From time to time, we get people asking how they can remove the Shipping Calculator feature in WP eCommerce.  You’ve probably come across these before: before calculating shipping, you have to enter your ZIP code or state or something like that.  Pretty standard fare.

The problem, of course, is that it can be an unnecessary extra step, causing friction in the checkout process.  For example, it’s totally unnecessary if you only ship to one country and ship with a flat rate to that country, it makes no sense to have a shipping calculator.   So – let’s dig in!

If you haven’t moved your shopping cart template file to your active theme folder, now’s the time to do that :)  In a normal installation, you’ll have a shipping calculator that looks something like this:

shipping-calculator

Step 1: Presentation

The first step is removing the calculator from your theme.  There’s not a single chunk of code to remove, but a few.  Thankfully, they’re all right around the same place.

  1. Remove the “Calculate Shipping Price” header.
  2. Remove built-in error/notice conditions, country and ZIP drop-downs.

At this point, the shipping calculator should be visibly absent.  Woohoo!

Step 2: Functional Logic

Even though we’re looking good now, we’re not working good.  That’s a problem.  The first thing you’ll notice is that when you hit purchase, you get scrolled back to the top of the page with a message that says you need to calculate shipping.  While we have filters that control whether or not you should force that sliding UX, we have even better filters to control whether or not to force a recalculation.  The following filter in a plugin

add_filter( 'wpsc_needs_shipping_recalc', '__return_false' );

This gets us one step closer, but astute observers may note that shipping quotes no longer show up.  This is because none are calculated.  The following code ensures a rate is calculated:

add_action( 'template_redirect', function() {
    if ( is_page( wpsc_get_the_post_id_by_shortcode( '[checkout]' ) ) ) {
        wpsc_update_location();
    }
} );

If you’re only using a single shipping method with a single rate (as most folks who request this seem to be), you’re all set.  The steps above are all you need to do to kill off the shipping calculator for good :)

If you’re using multiple shipping methods?  Well, that gets trickier, and depends on which methods you’re using.  If this is an issue you’re facing, I’d be more than happy to chat with you about it.

Give me a call

Join the Conversation

10 Comments

  1. As a non programer this answers a question and raises a question.

    You have the following statement:
    The following filter in a plugin

    Does this mean I need to make a custom plugin, or can this be inserted into a page on the site?

      1. Hi’
        i’ve followed the above instructions but get the error plugin disabled, it doesn’t like the 2nd code snippet:

        add_action( ‘template_redirect’, function() {

        if ( is_page( wpsc_get_the_post_id_by_shortcode( ‘[checkout]’ ) ) ) {
        wpsc_update_location();
        }

        } );

        Does that code need to be between separate php brackets? I’ve tried but no luck, Could you possibly share the full code?

        1. Hi Cath,

          It’s very possible that you might be running a server with PHP 5.2, rather than 5.3+. This type of function, sometimes called a closure or anonymous function, is a feature of PHP 5.3+. You might confirm this with your host?

  2. Hi Justin,

    I’m trying to follow the above steps and have had a go at removing what I think are the correct sections from wpsc-shopping_cart_page.php, but I would like to add the Functional Logic section directly to my functions.php file.

    Is it possible you could add a little more clarification on exactly what to remove from the shopping cart page and whether I can add to functions.php please?

    1. Hi Amanda!

      Great question (sorry for the delayed response!)

      You can definitely add the code to your functions.php file.

      As far as which sections to remove from the shopping cart page, those are outlined in Step 1.

      Hope that helps!

  3. Thanks Justin, that was really helpful.
    Created a plugin as suggested and activated it – hey presto – no more requests for recalculations.
    Im now going to make this apply ONLY if simple_shipping is the selected method.
    Wish me luck!

Leave a comment

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