Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Marketplace (WooCommerce Multivendor Marketplace) › How to add Tab in Single Product Page, editable from Vendor dashboard
Tagged: add custom tab, Vendor Dashboard, wcfm
- This topic has 1 reply, 2 voices, and was last updated 4 years, 6 months ago by Sushobhan.
- AuthorPosts
- May 19, 2020 at 11:48 pm #133238delwynParticipant
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. - May 20, 2020 at 2:24 pm #133481SushobhanKeymaster
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!
- AuthorPosts
- You must be logged in to reply to this topic.