Book Image

Mastering WooCommerce 4

By : Patrick Rauland
Book Image

Mastering WooCommerce 4

By: Patrick Rauland

Overview of this book

WooCommerce is one of the most flexible platforms for building online stores. With its flexibility, you can offer virtually any feature to a client using the WordPress system. WooCommerce is also self-hosted, so the ownership of data lies with you and your client. This book starts with the essentials of building a WooCommerce store. You’ll learn how to set up WooCommerce and implement payment, shipping, and tax options, as well as configure your product. The book also demonstrates ways to customize and manage your products by using SEO for enhanced visibility. As you advance, you’ll understand how to manage sales by using POS systems, outsource fulfillment, and external reporting services. Once you’ve set up and organized your online store, you’ll focus on improving the user experience of your e-commerce website. In addition to this, the book takes you through caching techniques to not only improve the speed and performance of your website but also its look and UI by adding themes. Finally, you’ll build the landing page for your website to promote your product, and design WooCommerce plugins to customize the functionalities of your e-commerce website. By the end of this WooCommerce book, you’ll have learned how to run a complete WooCommerce store, and be able to customize each section of the store on the frontend as well as backend.
Table of Contents (15 chapters)

Variable products

Simple products such as coffee cups and umbrellas are great, but many products have some variation. Posters come in multiple sizes, phone cases come in multiple colours, and clothes come in sizes and colours. For these types of products, we have variable products (https://docs.woocommerce.com/document/variable-product/).

We're going to build on what we learned in the last section and we're going to look into a few concepts specific to variations:

  • Attributes: These describe our products, for example, size or colour.
  • Variations: These are options our users select, for example, a small t-shirt.
  • Images for variation: These are uploaded differently than simple products.
  • Multi-attribute products: These are for configuring multiple attributes in the backend (for example, size and colour).
  • Troubleshooting variations: This is for what to do when something isn't working.

The first thing we have to do is select Variable product at the top of the Product data panel:

In many ways, variable products are configured exactly like simple products but the information in the backend is slightly rearranged.

Attributes

To be able to select what you want in a product, WooCommerce has to know what the options are. These options are called attributes and they can be found in Product data | Attributes:

There are two types of attributes:

  • Custom product attribute
  • Global attribute

Functionally speaking, they're almost identical. The biggest difference is that global attributes can be reused between products where custom product attributes have to be created for each product, which means a lot less typing on your end.

Another difference is that global product attributes can be used for filtering. So, if you have filters on the shop page to help users to navigate your products, you can filter by specific attributes and this can only be done with global product attributes. If you have a product with unique attributes that no other product will have, then it's convenient to use the custom product attributes:

  1. Let's add a global product attribute under Products | Attributes.
  2. Add a Name for the attribute. The attribute is the name of the categorization, for example, colours, sizes, and cuts—not red, small, or v-neck:

  1. Then, click on Configure terms. This will let you configure individual values.
  2. Now, go ahead and add your values, for example, Red, Blue, and Green:

Now, let's take a look at variations for the products.

Variations

Now that we've added attributes, we can use them to create variations. To do so, follow these steps:

  1. Refresh your edit product page. Then, go to Product data | Attributes.
  2. Select your attribute from the drop-down menu and click Add.
  3. You can select your values. If you have clothes that generally come in small, medium, large, and extra large, you might have a particular item that only comes in small and medium. In that case, just select small and medium:
  1. Make sure you check Used for variations.
  2. Click Save attributes.
  3. Click on the Variations tab in the Product data panel. From here, you can add individual variations. In the drop-down menu, select Add variation:

Editing individual variations

Once you have a variation, you can click into it and see per-variation settings. Fields such as Regular price ($), Sale price ($), SKU, inventory, and images are all very easy to customize via variation:

You can add as many variations as you want, although for maintenance purposes as well as clarity I try not to have too many options.

When you're done with each variation, make sure to click Save changes, and when you're done editing the product, click Update.

I've gone ahead and created two variations. Here's what they look like on the frontend:

And here's the same product once we've selected a different option from the drop-down menu:

Let's get started with variations in the next section.

Images for variations

Before we move forward, I want to highlight one aspect that's a little confusing about variations. You can have variations, each with their own unique product image. To do this, follow these steps:

  1. In the backend under Variations, you can select an image:
  1. Then, select that variation via drop-down menus; you'll see the image replace the main product image.

This is one of the most useful application variations as you can show people what they're going to get with each variation.

Multi-attribute variations

Some products have multiple attributes. A good example is clothing that could come in different colours and sizes.

You follow the preceding steps in the Attributes and Variations sections, except instead of adding one attribute, you add multiple attributes and make sure they're all used for variations.

With clothing that has a different image for each colour, we can create a variation for each colour and for the size, we can set Any Size:

When a user selects the size and colour, the main image will be replaced and users can add the item to their cart.

Troubleshooting variations

If you ever notice that you don't see the Add to cart button on the frontend after selecting options in drop-down menus, there's very likely something going on wrong with your site.

Since the variations functionality uses JavaScript, it's often a JavaScript error that's preventing product variations from working correctly. It's very likely an error in your theme or one of your plugins.

Using a test site, disable all of your plugins and switch to a default theme and you should see the issue go away. Then, switch your theme back on and see whether the issue persists. If it doesn't appear, turn on your plugins one by one until you see the issue. Then, you know which plugin is responsible and you can reach out to the developer for support.