Custom WooCommerce Plugin Development

Last Updated : June 12, 2020

We have completed the admin side things of Custom WooCommerce Plugin Development. Its time to move on the frontend stuff, so let’s get started.

Product Detail Page

In WooCommerce the page that contains all the details related to a specific product is the product detail page. Next I want to show you, how to display the Manufacturer on product details page.

WooCommerce provides action & filter hooks for template customization. The action hook woocommerce_single_product_summary hooks our function display_manufacturer(). In below code its very straight forward you just need to fetch the manufacturer and display it.


Manufacturer Archive Template

The Manufacturer archive template is similar to any custom post type template. The archive template file name should be archive-{custom-post-type-name} e.g archive-manufacturer.php

Within array the ‘post_type’ => ‘manufacturer’ will be fetched from database WP_Posts table and displayed on archive template page.

$args = array(
			'post_type' => 'manufacturer',
			'posts_per_page' => 10,
			'paged'          => $paged,

Add the following code to templates\manufacturer\archive-manufacturer.php file

From WordPress admin create new page “All Manufacturers” and set its page template manufacturer.


Manufacturer Single Template

The Single Template display individual Manufacturer detail. The code within below template is a straight forward.

Add the following code to templates\manufacturer\single-manufacturer.php file


Hook Template on Frontend

We have completed our frontend templates. Adding custom post type template file within Theme or Child Theme is a piece of cake. But when you add it to plugin it’s sometime little tricky. I have added the code in a clean way, so that you can also use within your own plugin.

  • theme_page_templates Filters list of page templates for a theme.
  • page_template filter can be used to load a custom template for a given page.
  • single_template filter can be used to load a custom template for a given post.

It’s time to hook the templates to display them. Add following code to manufacturer.php


Final Manufacturer File

Below is the plugin root manufacturer.php file. You can download the complete plugin from

Download Complete Plugin Code

Display WooCommerce Discount to Customer for Product on Sale

Best WooCommerce Customization Practices

WooCommerce Hooks Actions & Filters

Share post with others

2 thoughts on “Custom WooCommerce Plugin Development”

Leave a Comment