How to Create a Custom WooCommerce Product Type – 2026

Last updated on September 24th, 2024 at 09:25 am

WooCommerce provides several default product types such as Simple, Variable, Grouped, and External products. But what if your store has unique needs that don’t quite fit into these categories? This is where custom product types come in. By creating your own product type, you can tailor WooCommerce to suit your specific requirements.

In this guide, we’ll walk you through how to add a custom WooCommerce product type. This process requires custom code but don’t worry—it’s relatively straightforward. As always, ensure you are working in a child theme to keep your changes safe from theme updates.

Why Create a Custom Product Type?

A custom WooCommerce product type can be useful in several situations:

  • Subscription Products: If you’re selling products on a subscription basis, you might need custom functionality.
  • Rental Products: For stores that rent products instead of selling them, creating a custom product type ensures you can add unique features, such as rental periods.
  • Custom Service Packages: If you sell services instead of physical products, a custom product type allows you to modify the behaviour of WooCommerce accordingly.

Adding the Custom Product Type

Here’s a snippet of code that will allow you to create a custom WooCommerce product type. Simply add it to your theme’s functions.php file, or if you prefer to stay safe, use a child theme.

/*
 * Snippet: How to Create a Custom WooCommerce Product Type – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1496
* Tested with WooCommerce 10.7.0
* "This function adds a custom WooCommerce product type"
*/ function wcsuccess_add_custom_product_type() { class WC_Product_Custom_Type extends WC_Product { public function __construct( $product ) { $this->product_type = 'custom_product_type'; // Define product type slug parent::__construct( $product ); } } } add_action( 'init', 'wcsuccess_add_custom_product_type' );

This snippet defines a custom WooCommerce product type, custom_product_type, which you can extend further by adding your custom fields or behaviour.

Displaying the Custom Product Type in the Admin

Next, you’ll want to display your new product type in the WooCommerce admin. Here’s how to add it to the product type dropdown.

/*
 * Snippet: How to Create a Custom WooCommerce Product Type – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1496
* Tested with WooCommerce 10.7.0
* "This function adds the custom product type to the admin product dropdown"
*/ function wcsuccess_custom_product_type_selector( $types ) { $types[ 'custom_product_type' ] = __( 'Custom Product Type', 'your-textdomain' ); return $types; } add_filter( 'product_type_selector', 'wcsuccess_custom_product_type_selector' );

This code snippet adds your new product type to the admin product dropdown, so you can easily assign it when creating or editing a product in WooCommerce.

See also  How to Show Shipping Rates on the Single Product Page in WooCommerce - 2026

Customising the Custom Product Type

Now that your custom product type is created, you can extend its functionality to fit your store’s needs. You may want to:

  • Add custom fields: Allow store owners to define additional data for this product type, like rental periods or subscription lengths.
  • Modify the pricing or checkout behaviour: Customise how the product interacts with WooCommerce’s cart and checkout systems.

Here’s an example of how you can add custom fields to your product type:

/*
 * Snippet: How to Create a Custom WooCommerce Product Type – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1496
* Tested with WooCommerce 10.7.0
* "This function adds custom fields to the custom product type"
*/ function wcsuccess_custom_product_data() { global $post; echo '<div class="options_group">'; woocommerce_wp_text_input( array( 'id' => '_custom_text_field', 'label' => __( 'Custom Text Field', 'woocommerce' ), 'desc_tip' => 'true', 'description' => __( 'Enter custom text here.', 'woocommerce' ) ) ); echo '</div>'; } add_action( 'woocommerce_product_options_general_product_data', 'wcsuccess_custom_product_data' ); function wcsuccess_save_custom_product_data( $post_id ) { $custom_field_value = isset( $_POST['_custom_text_field'] ) ? sanitize_text_field( $_POST['_custom_text_field'] ) : ''; update_post_meta( $post_id, '_custom_text_field', $custom_field_value ); } add_action( 'woocommerce_process_product_meta', 'wcsuccess_save_custom_product_data' );

This code adds a custom field to your product settings, allowing you to input unique data for your custom product type and then save it when the product is updated.

Best Use Cases for Custom Product Types

  • Subscription Services: You can create a custom product type for subscription-based products, setting up custom billing intervals and pricing options.
  • Rental Items: For stores that rent equipment or products, adding a rental period field makes managing rentals easier.
  • Special Bundled Services: If your store sells custom services that don’t fit the default WooCommerce types, creating a custom product type ensures you can manage orders effectively.
See also  WooCommerce Automatic Add-to-Cart on Visit - 2026

Conclusion

By adding a custom WooCommerce product type, you can take control over your store and ensure it meets your unique business needs. Whether it’s for subscriptions, rentals, or other specialised products, this approach gives you the flexibility to build a store tailored to your customers.

Remember to always test new custom code in a child theme to avoid losing any work due to theme updates. You can also find additional WooCommerce customisations, such as the WooCommerce Visual Hooks Guide, to enhance your store further.

0 0 votes
Article Rating

Stay In Touch

Was this post helpful? Why not show your support and buy me a coffee?

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Scroll to Top
0
Would love your thoughts, please comment.x
()
x
×