enter image description here

I’m adding extra meta boxes to be called inside tabs in front end. This is added inside add new product page.But it gives error saying: Warning:

call_user_func() expects parameter 1 to be a valid callback, class
‘WC_Meta_Box_Product_Features_Advantages’ not found in
C:wampwwwmysitewp-adminincludestemplate.php on line 1048

screenshot:

I simply followed the way short description meta box added. Thus, I created a class file in this location:

C:wampwwwmysitewp-contentpluginswoocommerceincludesadminmeta-boxesclass-wc-meta-box-features-advantages-.php

and the content looks like:

<?php
/**
 * Product Features Advantages
 *
 * Replaces the standard excerpt box.
 *
 * @author      WooThemes
 * @category    Admin
 * @package     WooCommerce/Admin/Meta Boxes
 * @version     2.1.0
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly
}

/**
 * WC_Meta_Box_Product_Features_Advantages Class.
 */
class WC_Meta_Box_Product_Features_Advantages {

    /**
     * Output the metabox.
     *
     * @param WP_Post $post
     */
    public static function output( $post ) {

        $settings = array(
            'textarea_name' => 'features_advantages',
            'quicktags'     => array( 'buttons' => 'em,strong,link' ),
            'tinymce'       => array(
                'theme_advanced_buttons1' => 'bold,italic,strikethrough,separator,bullist,numlist,separator,blockquote,separator,justifyleft,justifycenter,justifyright,separator,link,unlink,separator,undo,redo,separator',
                'theme_advanced_buttons2' => '',
            ),
            'editor_css'    => '<style>#wp-excerpt-editor-container .wp-editor-area{height:175px; width:100%;}</style>',
        );

        wp_editor( htmlspecialchars_decode( $post->post_excerpt ), 'features_advantages', apply_filters( 'woocommerce_product_features_advantages_editor_settings', $settings ) );
    }
}

Also added few more lines here: C:wampwwwmysitewp-contentpluginswoocommerceincludesadminclass-wc-admin-meta-boxes.php inside add_meta_boxes() function.

add_meta_box( 'features_advantages', __( 'Product Features and Advantages', 'woocommerce' ), 'WC_Meta_Box_Product_Features_Advantages::output', 'product', 'normal' );

and this line inside remove_meta_boxes()

remove_meta_box( 'features_advantages', 'product', 'normal' );

Read more here: Error in adding extra meta box for woocommerce


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: