Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Marketplace (WooCommerce Multivendor Marketplace) › How can Vendors add a Custom Tab in Product page
Tagged: custom tab, wcfm, Woocommerce
- This topic has 5 replies, 2 voices, and was last updated 4 years, 6 months ago by Sarmistha Chakraborty.
- AuthorPosts
- May 19, 2020 at 12:47 am #132801delwynParticipant
Hi,
Is there anyway Vendors can add a custom tab at the product page?
(See ATTACHED IMAGE)
I want to allow vendors to add a “Delivery” tab the product page.
This is because different vendors have different delivery schedule.
Please help.
Attachments:
You must be logged in to view attached files. - May 19, 2020 at 1:52 pm #132989Sarmistha ChakrabortyMember
Hello,
Add this code to your child theme’s functions.php
In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/add_filter( 'woocommerce_product_tabs', 'wcfm_product_delivert_tabs', 100, 1 ); function wcfm_product_delivert_tabs( $tabs ) { $tabs['wcfm_product_delivert_tab'] = apply_filters( 'wcfm_product_delivert_tab_element',array( 'title' => __( 'Delivery', 'woocommerce' ), 'priority' => 55, 'callback' => 'wcfm_delivery_product_tab_content' ) ); $prod_id = get_the_ID(); $vendor_id = wcfm_get_vendor_id_by_post( $prod_id ); $vendor_delvery_schedules = get_user_meta($vendor_id,'wcfm_vendor_delivery_time',true); if(!isset($vendor_delvery_schedules['enable'])) { unset($tabs['wcfm_product_delivert_tab']); } return $tabs; } function wcfm_delivery_product_tab_content() { global $WCFM, $product; $product_id = get_the_ID(); $vendor_id = wcfm_get_vendor_id_by_post( $product_id ); $vendor_delvery_schedules = get_user_meta($vendor_id,'wcfm_vendor_delivery_time',true); //you can find all delivery sceduled data in this variable $days_map = array('Monday' => 0,'Tuesday' => 1, 'Wednesday' => 2, 'Thursday' => 3,'Friday' => 4,'Saturday' => 5,'Sunday' => 6); if(isset($vendor_delvery_schedules['enable'])) { if(!empty($vendor_delvery_schedules['off_days'])) { $off_days_arr = []; foreach ($vendor_delvery_schedules['off_days'] as $off_days) { $off_days_arr[] = array_search($off_days,$days_map); } echo 'Week Day OFF :'.implode($off_days_arr, ','); } } }
regarding above code, if vendor will enable the “Enable Delivery Time”, then “Delivery” tab will display in his product’s page.
Display all delivery schedule information is not possible with a small code snippet, we have provided you an example of code(display weekday off data) to how you display all data.Thanks.
- May 19, 2020 at 2:19 pm #132993delwynParticipant
Hi,
May i know how can the Vendor “Enable Delivery Time”?
I can’t seem to find this settings.
Thanks!
- May 19, 2020 at 3:03 pm #133029Sarmistha ChakrabortyMember
You will find the “Enable Delivery Time” vendor’s dashboard settings (PFA)
Thanks.
Attachments:
You must be logged in to view attached files. - May 19, 2020 at 4:13 pm #133085delwynParticipantThis reply has been marked as private.
- May 19, 2020 at 6:56 pm #133131Sarmistha ChakrabortyMember
Hello,
Have to install and activate “WCFM-Delivery”(https://wclovers.com/product/woocommerce-frontend-manager-delivery/) plugin? ” Delivery Times” tab coming from this plugin.
You can add custom field from vendor registration form. (admin WCFM dashboard -> Settings -> Vendor registration) Or using code.
Ref: https://wclovers.com/forums/topic/adding-new-fields-on/Regarding custom tab for product page, we have already provided you the code #132989 –
Ref: https://wisdmlabs.com/blog/add-custom-tab-woocommerce-product-page/Thanks.
- AuthorPosts
- You must be logged in to reply to this topic.