Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* STEP 1 */
- function register_simple_custom_product_type() {
- class WC_Product_Simple_Custom_Product extends WC_Product_Simple {
- public function __construct( $product ) {
- $this->product_type = 'simple_custom';
- parent::__construct( $product );
- }
- }
- }
- add_action( 'init', 'register_simple_custom_product_type' );
- /* STEP 2 */
- function add_simple_custom_product( $types ){
- $types[ 'simple_custom' ] = __( 'Simple custom' );
- return $types;
- }
- add_filter( 'product_type_selector', 'add_simple_custom_product' );
- /* STEP 3*/
- function custom_product_tabs( $tabs) {
- $tabs['custom'] = array(
- 'label' => __( 'Custom', 'woocommerce' ),
- 'target' => 'custom_options',
- 'class' => array( 'show_if_simple_custom', 'show_if_variable_custom' ),
- );
- return $tabs;
- }
- add_filter( 'woocommerce_product_data_tabs', 'custom_product_tabs' );
- function custom_product_data_panels(){
- global $post; ?>
- <div id="custom_options" class="panel woocommerce_options_panel wc-metaboxes-wrapper">
- <div class="options_group custom_simple">
- Hello
- </div> <!-- options group -->
- </div>
- <?php
- }
- add_action( 'woocommerce_product_data_panels', 'custom_product_data_panels' );
- function so_42253729_add_pre_order_support( $types ){
- $types[] = 'simple_custom';
- return $types;
- }
- add_filter( 'wc_pre_orders_supported_product_types', 'so_42253729_add_pre_order_support' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement