Chapter 10: Custom Product Types
Chapter 10 of 15
Chapter 10: Custom Product Types
10.1 Creating Custom Types
Develop custom product types for specialized products.
class WC_Product_Custom extends WC_Product {
public function __construct($product) {
$this->product_type = 'custom';
parent::__construct($product);
}
public function get_type() {
return 'custom';
}
}
10.2 Registering Custom Types
Register custom product types with WooCommerce.
add_filter('product_type_selector', 'add_custom_product_type');
function add_custom_product_type($types) {
$types['custom'] = 'Custom Product';
return $types;
}