Woocommerce & Tabs

Support MB Tabs Woocommerce & TabsResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #42753
    JoeJoe
    Participant

    hi,
    question for the backend admin
    how can I move the wocommerce description and woocommerce shortdescrition into a tab, like it is possible with CPTs with post_content and post_excerpt .......

    #42760
    PeterPeter
    Moderator

    Hello Joe,

    First, you need to remove the default product description and product excerpt by using this code

    add_action( 'init', function () {
        remove_post_type_support( 'product', 'editor' );
    } );
    
    function remove_short_description() {
         remove_meta_box( 'postexcerpt', 'product', 'normal');
    }
    add_action('add_meta_boxes', 'remove_short_description', 999);

    Then register two custom fields with the ID content and excerpt and put them anywhere in a field group then assign the field group to the Product post type.

    $meta_boxes[] = [
        'title'      => __( 'Product meta', 'your-text-domain' ),
        'id'         => 'product-meta',
        'post_types' => ['product'],
        'fields'     => [
            [
                'name' => __( 'Product Content', 'your-text-domain' ),
                'id'   => 'content',
                'type' => 'wysiwyg',
            ],
            [
                'name' => __( 'Product Excerpt', 'your-text-domain' ),
                'id'   => 'excerpt',
                'type' => 'wysiwyg',
            ],
        ],
    ];
    #42794
    JoeJoe
    Participant

    Excellent, thank you very much,
    can you extend the code for the sku, regular price and discounted price ?

    #42799
    PeterPeter
    Moderator

    Hello,

    You can ask WooCommerce support for providing a way to hide those default fields in the admin area and create the same field IDs with Meta Box to save to the database.

    If you are not able to complete the task, please contact us here https://metabox.io/contact/
    our development team will help you with an extra fee.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.