The brands extension for WooCommerce allows you to create brands for your shop; each brand can be named, described and assigned an image.
Installation ↑ Back to Top
To install the brands extension:
- Download the extension from your dashboard
- Upload the plugin folder to your /wp-content/plugins/ directory
- Activate ‘WooCommerce Brands’ from the Plugins menu within WordPress
Usage ↑ Back to Top
To start adding brands, first browse to Products > Brands. The interface works just like adding categories and tags; the form on the left lets you add a brand and then they are displayed on the right.
Give brands a name, description, and optionally an image. Brands can also be hierarchical:
When you’ve added your brands they will be listed on the right. You can edit them by clicking their names, or re-order them by dragging and dropping.
Assigning a brand to a product
Assigning brands to products is the same process as adding categories and tags:
Please note however, when showing brands on the single page, some of the shortcodes will only pull 1 brand rather than all.
Shortcode reference ↑ Back to Top
Brands adds the following shortcodes for usage.
Shows a brand’s image with a link to its archive page. This only works on product pages, not on posts or other WordPress pages.
Args: width, height, class (default: aligncenter)
[product_brand width="64" height="64" class="alignright"]
Shows an A-Z index of brands with links to archive pages.
Args: show_top_links (default: true), hide_empty (default: 0 = shows brands, 1 = hides brands)
Show top links refers to “back to top” links under each brand section.
Hide empty set to 1 is used to hide letters for with no brands (otherwise they are greyed out).
Hide empty set to 0 lets you show brands which have no products inside, if you wish.
[product_brand_list show_top_links="true" hide_empty="1"]
Shows a list of product brand thumbnails with links to their archives.
Args: columns (default: 12), show_empty (default: true), orderby (the order, defaults to name), exclude (ids to exclude, comma separated), number (number to show, defaults to all)
[product_brand_thumbnails columns="12" show_empty="false"]
Adding a Brand Image to the Product Page
In some situations, you may want to display the brand image associated with the product in your product page, as shown below:
There are two ways to implement this, either on a single product basis or applying to all products.
To apply to a Single Product
In the product’s body area, you can add the shortcode
[[product_brand width="64" height="64" class="alignright"]
In that example, it would link to the brand of the product, establish the width and height in pixels (each 64), and align it to the right side. The ‘class’ field isn’t required – it’s by default set to ‘aligncenter’, but you can do left or right as well.
To apply to All Products
First, you should make sure that you’re making edits in a child theme – this allows you to customize your content without running the risk of an update removing your work. To learn more about how to customize a child theme, please visit our child theme tutorial, or you can read more about how child themes work in the WordPress Codex.
Then, you would open up the template file in your child theme and enter the following code (wrapped in a PHP tag) where you want the image to display:
echo do_shortcode("[product_brand width="64" height="64" class="alignright"]");
You’ll notice its just the same as the shortcode before, but wrapped in a PHP tag so you can apply it everywhere.
Widgets ↑ Back to Top
To learn more about how to add the Brands Widgets listed below to your site please see our tutorial here: How to Add Widgets
This widget shows the description for the currently viewed brand archive.
This widget provides layered navigation for products based on brand.
This widget lists brands with thumbnails.
Functions ↑ Back to Top
get_brand_thumbnail_url( $brand_id )
Get a brands image for use within PHP code.
get_brands( $post_id = 0, $sep = ‘, ‘, $before = ”, $after = ” )
Gets a comma separated list of brands for a product.
Settings ↑ Back to Top
The settings can be found in WooCommerce > Settings > Catalog.
- Show description – Choose whether or not to show the brand description on the archive. This is useful if you want to show the description in your sidebar via a widget instead.