I want to add a new custom “product type” to woocommerce plugin:
Tried to duplicate one of currently exist product type files (woocommerce template structure) as a new file (file name and inside commented name) but not worked!
I want to add a new custom “product type” to woocommerce plugin:
Tried to duplicate one of currently exist product type files (woocommerce template structure) as a new file (file name and inside commented name) but not worked!
Comments are closed.
The add to cart template is only 1 of the many things you’ll need to do. Each product type has it’s own class in the
/includes/
folder. Each one extends theWC_Product
class.To add items to the list you’ve screencapped (which is on the admin side and not the front-end, unlike the
add-to-cart.php
template, you will need to filterproduct_type_selector
.then you’ll need to declare your product class. The standard naming system is
WC_Product_Type_Class
so in this example it would be:You are asking a very complicated question and I can’t provide a more complete answer. Hopefully this sets you on the right path. I highly encourage you to read the code in WooCommerce. It is very well commented and you can see how they are handling the different product types.
Edit Added WC3.0 compatibility to product type class.