How to add Tab in Single Product Page, editable from Vendor dashboard

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM – Marketplace (WooCommerce Multivendor Marketplace) How to add Tab in Single Product Page, editable from Vendor dashboard

Viewing 1 reply thread
  • Author
    Posts
    • #133238
      delwyn
      Participant

      Hi,

      May I know, how can i add an Additional / New Tab in the Single Product Page?

      (See Attached screenshot)

      Also, this tab should allow Vendors to edit its text area from the Vendor’s dashboard (not the WP Admin dashboard).

      Please help.

      Thanks!

      Attachments:
      You must be logged in to view attached files.
    • #133481
      Sushobhan
      Keymaster

      Hi,
      Thanks for getting in touch with us!
      For this approach, you’ll require the WCFM Ultimate addon. First, go to admin Settings >> Product Custome Field. From here create the fields you want to show under your new tab. But, under visibility choose ‘Do not show’ (because we are going to show these fields under our new tab).
      Now from add/edit product screen add those information. Lastly, use the following snippet to add a new tab and show these details-

      add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
      function woo_new_product_tab( $tabs ) {
          $tabs['new_tab'] = array(
              'title'    => __( 'My Tab', 'woocommerce' ),
              'priority' => 53,
              'callback' => 'woo_new_product_tab_content'
          );
          return $tabs;
      }
      
      function woo_new_product_tab_content() {
          global $WCFMu;
          $product_id = get_the_ID();
          if ( $product_id ) {
              $wcfm_product_custom_fields = (array) get_option( 'wcfm_product_custom_fields' );
              if ( $wcfm_product_custom_fields && is_array( $wcfm_product_custom_fields ) && ! empty( $wcfm_product_custom_fields ) ) {
                  $fields = '';
                  foreach ( $wcfm_product_custom_fields as $wpcf_index => $wcfm_product_custom_field ) {
                      if ( ! isset( $wcfm_product_custom_field['enable'] ) )
                          continue;
                      $visibility = isset( $wcfm_product_custom_field['visibility'] ) ? $wcfm_product_custom_field['visibility'] : '';
                      if ( $visibility )
                          continue; //we are not showing the fields that are allready visible in some other areas of the product
                      echo $WCFMu->wcfmu_customfield_support->get_wcfm_custom_field_display_data( $product_id, $wcfm_product_custom_field );
                  }
              }
          }
      }

      Add this code to your child theme’s functions.php
      In case you do not have a child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/
      Let me know how this goes.
      Thanks!

Viewing 1 reply thread
  • You must be logged in to reply to this topic.