我创建了一个新的产品类型“ Crush Video Product”。它从其自定义选项卡中正确保存所有元字段。
// add a product type
add_filter( 'product_type_selector', 'crush_add_custom_product_type' );
function crush_add_custom_product_type( $types ){
$types[ 'crush_video_product' ] = __( 'Group Video Class' );
return $types;
}
// Initiate Class when plugin is loaded
add_action( 'plugins_loaded', 'crush_create_custom_product_type' );
function crush_create_custom_product_type(){
// declare the product class
class WC_Product_Crush_Video_Product extends WC_Product{
public function __construct( $product ) {
$this->product_type = 'crush_video_product';
parent::__construct( $product );
// add additional functions here
}
// Needed since Woocommerce version 3
public function get_type() {
return 'crush_video_product';
}
}
}
我见过一些插件,产品类型的名称写在管理区域的产品名称之后,您可以在管理区域看到所有产品。
我搜索了很多,但找不到一个钩子来做到这一点。
元芳怎么了