Product tabs

Hello,

I use the BeBabyShop template.

Now I want to create an extra tab there for the products where I want to display a quotation form with contactform7. Normally this can be done with a small piece of code in the functions.php. But it doesn't work with this theme. So I don't dare to buy a plugin with which it is possible because there is a chance that it will not work either. In the past I have already used Xforwoocommerce.

So now I just added the content to the description tab. However, it is now at the very top and I want it below the description information.

testsite

Not sure if you can help me or give me advice on this.

Thanks

Roy

Comments

  • Hi,

    Please, go to Betheme -> Theme options -> Global -> Advnaced, change the Content display order to BeBuilder - WP Editor, and check if the form displays at the end then.

    If this will not work, please, tell me how did you place this form there? Did you use a shortcode for that?


    Best regards

  • Hello,

    That works.

    i used this for adding the contactform, placed it in functions.php:

    /**

     * Add a custom product contact form

     */

    add_filter('the_content', 'cf7_form_to_all_products');

    function cf7_form_to_all_products($content) {

        if ( class_exists( 'woocommerce' ) && is_product() && is_main_query() ) { 

        return $content . '[contact-form-7 id="1" title="Contactformulier 1"]';

      }   

      return $content;

    }

    add_filter( 'woocommerce_product_tabs', 'cf7_add_description_tab', 20 );

    function cf7_add_description_tab( $tabs ) {

      global $product, $post;


      if ( ! $post->post_content ) {

        $tabs['description'] = array(

          'title'  => __( 'Description', 'woocommerce' ),

          'priority' => 10,

          'callback' => 'woocommerce_product_description_tab',

    );

    }

       

      return $tabs;

     }


    And i tried this code for adding a extra tab, but that seems not to work.


    /**

     * Add a custom product data tab

     */

    add_filter( 'woocommerce_product_tabs', 'wc_new_product_tab' );

    function wc_new_product_tab( $tabs ) {

    $tabs['test_tab'] = array(

    'title' => __( 'New Product Tab', 'woocommerce' ),

    'priority' => 50,

    'callback' => 'wc_new_product_tab_content'

    );

    return $tabs;

    }

    function wc_new_product_tab_content() {

    // The new tab content

    echo '<h2>New Product Tab</h2>';

    }


    The best solution for me is that i can add a new tab where the contactform shows.


    Thanks for the great support!

    Roy

  • Custom product templates do not have tabs and are divided into elements in BeBuilder.

    If you would like to put them in a tab that would require further file customization which we do not provide help with, unfortunately.


    Best regards

Sign In or Register to comment.