Unlimited Plugins, WordPress themes, videos & courses! Unlimited asset downloads! From $16.50/m

Next lesson playing in 5 seconds

  • Overview
  • Transcript

3.2 Adding Product Attributes

Adding extra attributes to our products will help us better structure the mega menu. In this lesson, I'll show you how.

3.2 Adding Product Attributes

Hello and welcome back to this Tuts Plus course on WooCommerce. In this part of the course we are going to start creating our mega menu. Before we can create our mega menu we need to create some taxonomies for it to work with. And WooCommerce gives you the ability to do that, without hardcoding taxonomies into your fame or a plug-in. So let's take a look. WooCommerce uses something called attributes. An attribute is effectively a new taxonomy that you're registering for the product post type. So you can add them here using the WooCommerce interface instead of coding them into your fame. I'm going to add two attributes, and those will be range and audience. Now the reason I'm using attributes here rather than categories, is because range itself isn't a category. So I could, if I wanted to, use the categories. And as here we've got clothing, music, and posters as a top level category with subcategories beneath them. I could add range and audience as top level categories and then add the individual ranges and the individual audience such as men, women, and kids underneath the subcategories. But this isn't really the best way to do it, because range itself and audience itself, they're not categories in the same way as clothing, music, and posters. So I'm gonna use attributes. Now let's start by creating an attribute for our ranges. Slug for this will be range. I'm going to enable archives because I want people to be able to go to an archive for each range. And here under type, I'm going to keep this as Select because when I'm setting up my product, I want to be able to select a term from my range attribute for each product instead of just typing one in. And you'll see a bit more about how this works in a moment. Default sort order is going to be Name, which is the order in which WooCommerce will sort products on the archive page for that attribute. So now I click add attribute. Now at the moment, my range attribute doesn't really do very much. What I need to do is add some terms to that attribute, so I click on the configure terms button over here on the right. And I can add new ranges to my taxonomy. So let's start with Happy Ninja. That doesn't have a parent. And I'll add a description. Finally, I click on Add New Range, and you'll see that that's added to the list of ranges on the right hand side. Now, I'll add some more ranges. Now, I've added all the ranges to my taxonomy. And the next thing I'll do is add another attribute for the audience, so let's do that. I'll enable archives again, stay with select here, and I'm going to have custom ordering here. Allow that, and then click on configure terms. And add some terms. So, those are the terms and my audience taxonomy, or attribute, and let's just reorder these to a more logical order. So now I've added all my taxonomies in the form of attributes for WooCommerce. The next thing to do is add those attributes to some of my products. So let's sort them by name, so I can see what they're called, which will help me identify which ones are in which range. So here's Happy Ninja. This is a Happy Ninja hoodie, as you can see from the featured image. I'm gonna add the attribute in this tab here. I select Custom product attribute and Range. Then I click Add. And I select a term from the dropdown list, which is Happy Ninja. While I'm at it, I'll also add the audience. So here, I'll click on Audience. Add that. And select some terms. I'm going to select all of them here. And then I saved my product by clicking the Update button. So I view my product and here it is. So if I scroll down, you can see that an additional information tab has been added and that shows me the attributes that have been assigned to that product. So the range and the audience are both there. So what I need to do now, is repeat this with a number of my other products, and add attributes to those. So I'll go back into my admin screens on my products, and I'll repeat the process for some of the products. So I've now spent some time adding some more attributes to the rest of my products. Let's just take a look at a quick example. Here we have the Woo Ninja item, which is a poster. So that's got the range attributes set up, and if I open that, you can see that it's in the Woo Ninja range. I've added that to a whole bunch of my products. In the next part of the course, we'll set up our mega menu and we'll enable attributes in navigation menus using a filter. See you next time and thanks for watching.

Back to the top