How to Create Magento Attributes for Products

When you first set up a Magento site, your products will have a price, a weight, an image and some other popular e-commerce options.

However, these options won’t be enough for many stores. Different products have different needs. Here are some simple examples: 

  • A book store will require fields for the Publisher, the Date of Publication, and the ISBN number.
  • A clothing store may require fields for Type of Fabric, Clothing Size, and Clothing Color.
  • A car store may require fields for Engine, Body Type, and Miles Per Gallon.

Magento allows you to add all those details through the use of “attributes”. In this tutorial, I’ll show you how to use attributes in Magento.

This guide is taken from Magento 2 Explained, the best-selling book for Magento 2. We use the example of a store called “Orangeville” in that book, so you’ll see it referred to here.

Using Magento Attributes Explained

Without realizing it, you have been looking at attributes throughout this book.

Any information you’ve entered for a product has been using attributes. Let’s see what I mean:

  • Go to “Stores”, and then “Attribute Set”.
  • Click on “Default”.

magento attribute sets

You now see a page with three columns:

  • The left column is the name of this attribute set: “Default”.
  • The center column contains all the attributes that are being used.
  • The right column contains all the attributes that are not being used.

editing magento attribute sets

Let’s see how we can add an extra attribute to our site.

  • Drag the “manufacturer” attribute from the right column into the center column. Place it between “news_to_date” and “country of manufacturer”.

adding magento attributes

Now that we have two attributes that deal with manufacturing, let’s group them together.

  • Click the “Add New” button in the center column.

add new magento attribute group

  • Enter “Manfacturing”.
  • Click the “OK” button.

new magento attribute group

  • Your new “Manfacturing” group will appear at the bottom of the center column:

screen with new magento attribute group

  • Drag-and-drop the “Manfacturing” group up the center column, so it is positioned just above the “Content” group:

repositioning attribute groups

  • Move both “manufacturer” and “country_of_manufacturer” into your new “Manufacturing” group:

move attribute groups

Great! You now have a new attribute group. Let’s go and see how it appears when we’re editing products.

  • Go to “Products”, and then “Catalog”.
  • Click “Edit” next to “Oranges”.
  • Scroll down, and you’ll see a new “Manfacturing” area:

adding attributes to products

You will notice that the “Manufacturer” fields is empty and can’t be chosen. However, you can choose “Spain” from the “Country of Manufacture” dropdown:

manufacturer settings

The Manufacturer field is provided by default with Magento, but it doesn’t yet contain any choices. Let’s solve that next.

  • Click “Save & Close” for the Oranges product on your current screen.
  • Go to “Stores”, and then “Product”.
  • Scroll down on this screen, and click on the “Manufacturer” row.
  • Enter options for the Manufacturer field. I’ve chosen three fake companies:
    • Big Orange Corp
    • Big Mango Corp
    • Big Peaches Corp

magento attribute options

  • Save the attribute.
  • Go to “Catalog”, and then “Products”.
  • Edit the “Oranges” product.
  • Update the “Manufacturer” field:

editing magento attributes

  • Click “Save & Close”.
  • Go to visit the front of your site and check the “Oranges” product page.

Can you see the Manufacturing details you just added?

No, not yet.

We have more work to do before our attributes are visible.

viewing magento attributes

Displaying Magento Attributes Explained

Now that we’ve created attributes, let’s make them visible on the site:

  • Go to “Stores”, and then “Product”.
  • Take a look at the table of attributes. Notice that the “Country of Manufacture” has “No” in the “Visible” column:

displaying magento attributes

  • Click on the “Country of Manufacture” row.
  • Click the “Storefront Properties” tab.
  • Set “Visible on Catalog Pages on Storefront” to “Yes”.

visible magento attributes

  • Repeat that process for the “Manufacturer” attribute.
  • When you look at your attributes table again, both “Country of Manufacture” and “Manufacturer” will have “Yes” in the “Visible” column:

how to display magento attributes

  • Go to the front of your site and visit the “Oranges” product. You’ll see a new tab called “More Information”. This area contains your Magento attributes:

magento attributes in tabs

Creating New Magento Attributes Explained

In our first example, we used two existing attributes: “Country of Manufacture” and “Manufacturer”.

In this next example, let’s create a new Magento attribute for our products. This is going to be “Farming Method”, and the two choices will be “Organic” and “Non-Organic”.

  • Go to “Stores”, and then “Product”.
  • Click “Add New Attribute”.
  • Default Label: Farming Method
  • Catalog Input Type for Store Owner: Dropdown

magento attribute properties

  • Add “Organic” and “Non-Organic” as options:

add magento attribute properties

  • Click the “Storefront Properties” tab.
  • Set “Visible on Catalog Pages on Storefront” to “Yes”.
  • Save the attribute.

Our next step is to place the new attribute into the correct place in the editing screen:

  • Go to “Stores”, and then “Attribute Sets”.
  • Edit the “Default” attribute set.
  • Move the “farming_method” attribute from the right column into the “Manufacturing” group.

placing new magento attributes

  • Click the “Save” button.

Let’s go and see our new attribute in action inside a Product.

  • Go to “Products”, and then “Catalog”.
  • Edit the “Oranges” product.
  • Make your selection from the “Farming Method” field:

selecting new magento attributes

  • Save the product and visit the front of your site. There is your new attribute:

viewing new magento attributes

Searching With Attributes Explained

Attributes are not limited to simply displaying data. You can also allow customers to use attributes to search and browse your store.

Go to the front of your site and click on the “Fruit” link in the main menu. You’ll notice that there are filters on the left-hand side, including Manufacturer and Price.

magento attributes filters

How can you tell which attributes are available as filters?

  • Go to “Stores”, and then “Product”.
  • Look in the “Use in Layered Navigation” column. Any attribute with the text “Filterable (with results)” is going to be a filter.

enable magento attributes filter

Let’s make a change so that our new Magento attribute is available as a filter:

  • Click the “Farming Methods” row.
  • Click the “Storefront Properties” tab.
  • Change “Use in Layered Navigation” to “Filterable (with results)”.
  • Change “Use in Search Results Layered Navigation” to “Yes”.
  • Save this attribute.

magento attributes search options 

  • Visit the front of your site, and under the “Fruit” link your “Farming Method” filter is now an option:

magento attributes search view


  • Steve Burge

    Steve is the founder of OSTraining. Originally from the UK, he now lives in Sarasota in the USA. Steve's work straddles the line between teaching and web development.

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x