Creating a one-page checkout

WooCommerce was designed as a full-fledged e-commerce platform. Even if you use all of the features, there may be times where you want to have a special promotion and you don't need the full cart. For these times, there is the WooCommerce One Page Checkout extension, which can turn any page into a checkout page for a product or set of products. This is the perfect landing page for those store owners who use their newsletters to send out promotions; it's also good for people who want to have a custom checkout for some of their products.

Getting ready

You can create a one-page checkout with one product, but this recipe will show you how to do it with two or more products. You should have two products for this recipe.

You'll need the WooCommerce One Page Checkout plugin (available on WooThemes.com) installed and activated on your site.

How to do it…

We don't actually need to change any checkout settings. The default checkout will work just fine. We actually do everything through regular WordPress pages and shortcodes. Let's take a look at the following steps:

  1. From the WordPress admin, go to Pages | Add New.
  2. Enter a title for the page in the Title field.
  3. In the space where you would normally type in page content, note the new button that looks like a shopping cart.
    How to do it…
  4. A pop-up will appear and you can start typing the names of your products in the Products field. An autocomplete field will help you select the exact product.
  5. Select Product Table as Template.
    How to do it…

    Note

    There are four different templates at the time of this writing, and all of them have their uses. Single Product is obviously good if you only offer one thing on this page. Pricing Table is great when you have very similar products with features you can list in a table. Product List is great for similar products that don't need pictures and where the user can only select one option. Product Table is great for products that are different and where the user may want several different products.

  6. Click on Create Shortcode and you'll notice that some text (called a shortcode) is automatically inserted in the content of the page.
  7. Feel free to add anything you like before or after that shortcode.
  8. Click on Publish.

On the frontend of your site, you should see a one-page checkout similar to this:

How to do it…

How it works…

The text you see on the page after clicking on Create Shortcode is what controls the programming. If you ever want to edit how the one-page checkout works, it would be best to go through the process of creating the shortcode again. A typo in the shortcode could break the programming, so be careful. Click on the shopping cart icon button, go through the steps, and create a new shortcode. Then delete your old one.

There's more...

The WooCommerce One Page Checkout plugin integrates very nicely with the Easy Pricing Tables plugin mentioned in Chapter 4, Running a Membership Site.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset