How to Get Product Brand Name in WooCommerce

How to Get Product Brand Name in WooCommerceAre you using the WooCommerce brands plugin and you want to display it on the shop page? Read on, as this tutorial aims to help you with this problem.

The allows you to make brands for your shop. It also allows you to add the name, description, and picture of each brand. You can also display all the brand names on a single page using this plugin.

Get Product Brand Name WooCommerce

We recommend adding brand names to products in your store because brands are a source of competitive advantage, especially if many competitors are making similar products. You will also enjoy SEO benefits making your site rank higher in search results for the best conversion rates.

How to Display Brand name on the Shop and Category Pages

In this brief tutorial, we are going to share a custom PHP code snippet to display each product brand on the shop and category pages. Before you proceed, it is important to note that you are required to have the WooCommerce brands plugin installed for this solution to work.

You should also have some basic coding skills for you to implement the solution. We recommend creating a child theme so that your changes are not lost during an update.

Let us get right into it.

Steps to Display Brand name on the Shop and Category Pages

Here are the simple steps you need to follow:

  1. Log into your WordPress site and access the Dashboard as the admin user.
  2. From the Dashboard menu, click on Appearance Menu > Theme Editor Menu. When the Theme Editor page is opened, look for the theme functions file where we will add the function that will display the brand name on the shop and category pages.
  3. Add the following code to the php file:
[php] /**

 * @snippet       Display "Brands" at the Shop/Loop – WooCommerce

 */

add_action( ‘woocommerce_after_shop_loop_item_title’, ‘njengah_show_woocommerce_brands_loop’, 8 );

 function njengah_show_woocommerce_brands_loop() {

   global $post;

   echo get_brands( $post->ID );

}
[/php]

Conclusion

By now, you should be able to display the product brand name on the shop and category page. The code snippet we have shared has been tested and works well. You only need to have WooCommerce Brands installed for this snippet to work.

You should also be very careful when editing the functions.php file. If you make any mistake, a critical error will be displayed on the front end. You can always contact a qualified WordPress developer if you need further customization.

Similar Articles

  1. How to Create WooCommerce Custom Shop Page