Home / Knowledgebase / WCMp Hooks and Filters
Where to add the Snippets?Snippets are to be added to the functions.php file in your theme. If you have a custom theme developed for your site then simply paste the code into the functions.php and you’re good to go. However, if you are using a pre-built theme, it will be safe to create a child theme first and then paste the code snippet to its functions.php, thereby, preventing your modifications from being lost with a theme update.
Learn to add a child theme to your site from https://codex.wordpress.org/Child_Themes.
The following section gives a brief on the previous settings and it’s corresponding snippet.
Path of Setting
WCMp > Settings > General > General
Description
Checked: Knowledgebase Menu appears on the Vendor Dashboard for vendors to access tutorials.
Default: Checked
wcmp_vendor_dashboard_nav
Parameters
Snippet: Remove Knowledgebase Menu from Vendor Dashboard
add_filter( 'wcmp_vendor_dashboard_nav', 'filter_wcmp_vendor_dashboard_nav', 10, 1 ); function filter_wcmp_vendor_dashboard_nav( $vendor_nav ) { unset($vendor_nav['vendor-knowledgebase']); return $vendor_nav; }
Copy
Path of Setting
WCMp > Settings > General > Policies
Description
Changes the policy tab title on the single product page.
Default
Policies
wcmp_policies_tab_title
Parameters
Policy Tab Title Text
Snippet: Change Policy Tab Title
add_filter( 'wcmp_policies_tab_title', 'filter_wcmp_policies_tab_title' ); function filter_wcmp_policies_tab_title() { $policy_tab_title = 'Your Text Goes Here'; return $policy_tab_title; }
Copy
Related Setting: Enable Policies under General Tab
Path of Setting
WCMp > Settings > General > Policies
Description
Checked: Vendors can edit Shipping, Refund, Cancellation / Return / Exchange Policies (as is the case).
Default: Checked
wcmp_vendor_can_overwrite_policies
Parameters
Boolean
Snippet: Revoke Vendor’s capability to add/edit policies
add_filter( 'wcmp_vendor_can_overwrite_policies', '__return_false' );
Copy
Related Setting: Enable Policies under General Tab
Path of Setting
WCMp > Settings > General > Policies
Description
Changes the shipping policy title on single product page under Policy tab.
Default
Shipping Policy.
wcmp_shipping_policies_heading
Parameters
Shipping Policy Title Text
Snippet: Change Shipping Policy Title
add_filter( 'wcmp_shipping_policies_heading', 'filter_wcmp_shipping_policies_heading' ); function filter_wcmp_shipping_policies_heading() { $shipping_policy_title = 'Your Text Goes Here'; return $shipping_policy_title; }
Copy
Path of Setting
WCMp > Settings > General > Policies
Description
Changes the refund policy title on single product page under Policy tab.
Default
Refund Policy.
wcmp_refund_policies_heading
Parameters
Refund Policy Title Text
Snippet: Change Refund Policy Title
add_filter( 'wcmp_refund_policies_heading', 'filter_wcmp_refund_policies_heading' ); function filter_wcmp_refund_policies_heading() { $refund_policy_title = 'Your Text Goes Here'; return $refund_policy_title; }
Copy
Path of Setting
WCMp > Settings > General > Policies
Description
Changes the cancellation / return / exchange policy title on single product page under Policy tab.
Default
Cancellation / Return / Exchange Policy.
wcmp_cancellation_policies_heading
Parameters
Cancellation / Return / Exchange Policy Title Text
Snippet: Change Cancellation / Return / Exchange Policy Title
add_filter( 'wcmp_cancellation_policies_heading', 'filter_wcmp_cancellation_policies_heading' ); function filter_wcmp_cancellation_policies_heading() { $cancellation_policy_title = 'Your Text Goes Here'; return $cancellation_policy_title; }
Copy
Path of Setting
WCMp > Settings > General > Customer Support
Description
Checked: Vendors can add / edit vendor shop specific customer support details.
Default: Checked
wcmp_vendor_can_overwrite_customer_support
Parameters
Boolean
Snippet: Revoke Vendor’s capability to add/edit customer support details
add_filter( 'wcmp_vendor_can_overwrite_customer_support', '__return_false' );
Copy
Related Setting: Enable Customer Support under General Tab
Path of Setting
WCMp > Settings > Frontend
Description
Checked: Sold By text appears under products of shop page.
Default: Checked
wcmp_sold_by_text_after_products_shop_page
Parameters
Boolean, Product ID
Snippet: Remove Sold By Text Completely from shop page
add_filter( 'wcmp_sold_by_text_after_products_shop_page', '__return_false' );
Copy
Related Setting: Enable “Sold by” under General Tab
WCMp > Settings > Frontend
Description
Checked: Sold By text appears under products of cart and checkout page.
Default: Checked
wcmp_sold_by_text_in_cart_checkout
Parameters
Boolean, Product ID
Snippet: Remove Sold By Text Completely from cart and checkout page
add_filter( 'wcmp_sold_by_text_in_cart_checkout', '__return_false' );
Copy
Related Setting: Enable “Sold by” under General Tab
Path of Setting
WCMp > Settings > Frontend
Description
Changes the sold by text that appears under products on shop, cart and checkout page.
Default
Sold By.
wcmp_sold_by_text
Parameters
Sold By Text, Product ID
Snippet: Change Sold By Text on Shop, Cart, Checkout page
add_filter( 'wcmp_sold_by_text', 'filter_wcmp_sold_by_text' ); function filter_wcmp_sold_by_text() { $sold_by_text = 'Your Text Goes Here'; return $sold_by_text; }
Copy
Related Setting: Enable “Sold by” under General Tab
Single Product page > Report Abuse Link
Path of Setting
WCMp > Settings > Frontend
Description
Show / Hide Report Abuse Link
Default
Show
wcmp_show_report_abuse_link
Parameters
Boolean, Product Object
Snippet 1: Hide Report Abuse Link from Single Product page for all products
add_filter ( 'wcmp_show_report_abuse_link', '__return_false' );
Copy
Snippet 2: Show Report Abuse Link on all vendor products
function show_report_abuse_link_callback($bool, $product){ $vendor = get_wcmp_product_vendors($product->get_id()); // show only on vendor products if(!$vendor){ $bool = false; } return $bool; } add_filter('wcmp_show_report_abuse_link', 'show_report_abuse_link_callback', 10 ,2);
Copy
Path of Setting
WCMp > Settings > Frontend
Description
Change Report Abuse Link Text
Default
Report Abuse
wcmp_report_abuse_text
Parameters
Report Abuse Link Text, Product Object
Snippet: Change Report Abuse Link Text
add_filter ( 'wcmp_report_abuse_text', 'filter_wcmp_report_abuse_text' ); function filter_wcmp_report_abuse_text() { $report_abuse_text = 'Your Text Goes Here'; return $report_abuse_text; }
Copy
Path of Setting
WCMp > Settings > Frontend
Description
Change Blocked Vendor Text
Default
Site Administrator has blocked this vendor
wcmp_blocked_vendor_text
Parameters
Blocked Vendor Text, Vendor Object
Snippet: Change Blocked Vendor Text.
add_filter ( 'wcmp_blocked_vendor_text', 'filter_wcmp_blocked_vendor_text' ); function filter_wcmp_blocked_vendor_text() { $blocked_vendor_text = 'Your Text Goes Here'; return $blocked_vendor_text; }
Copy
Path of Setting
WCMp > Settings > Capabilities > Order
Description
Checked: Vendor can view order note added by the customer.
Default: Checked
is_vendor_can_view_order_notes
Parameters
Boolean, Vendor ID
Snippet: Prevent vendor from viewing order notes added by the customer.
add_filter ( 'is_vendor_can_view_order_notes', '__return_false' );
Copy
Path of Setting
WCMp > Settings > Capabilities > Order
Description
Checked: Vendor can add order note.
Default: Checked
is_vendor_can_add_order_notes
Parameters
Boolean, Vendor ID
Snippet: Prevent vendor from adding order notes.
add_filter ( 'is_vendor_can_add_order_notes', '__return_false' );
Copy
Path of Setting
WCMp > Settings > Capabilities > Order
Description
Checked: Vendor can see customer’s name, email and contact details (as is the case).
Default: Checked
show_customer_details_in_export_orders
Parameters
Boolean, Vendor ID
Snippet: Prevent vendor from seeing customer details on order export.
add_filter ( 'show_customer_details_in_export_orders', '__return_true' );
Copy
Path of Setting
WCMp > Settings > Capabilities > Order
Description
Checked: Vendor can see customer’s billing address.
Default: Checked
show_customer_billing_address_in_export_orders
Parameters
Boolean, Vendor ID
Snippet: Prevent vendor from seeing customer billing address on order export.
add_filter ( 'show_customer_billing_address_in_export_orders', '__return_false' );
Copy
Path of Setting
WCMp > Settings > Capabilities > Order
Description
Checked: Vendor can see customer’s shipping address.
Default: Checked
show_customer_shipping_address_in_export_orders
Parameters
Boolean, Vendor ID
Snippet: Prevent vendor from seeing customer shipping address on order export.
add_filter ( 'show_customer_shipping_address_in_export_orders', '__return_false' );
Copy
Path of Setting
WCMp > Settings > Capabilities > Order
Description
Checked: Vendor can see Customer’s order breakdown.
Default: Checked
show_cust_order_calulations_field
Parameters
Boolean, Vendor ID
Snippet: Prevent vendor from seeing customer’s order breakdown.
add_filter ( 'show_cust_order_calulations_field', '__return_false' );
Copy
Path of Setting
WCMp > Settings > Capabilities > Order
Description
Checked: Vendor can see Customer’s Email and Telephone.
Default: Checked
show_cust_address_field
Parameters
Boolean, Vendor ID
Snippet: Prevent vendor from seeing customer’s Email and Telephone.
add_filter ( 'show_cust_address_field', '__return_false' );
Copy
Path of Setting
WCMp > Settings > Capabilities > Order
Description
Checked: Vendor can see Customer’s Billing Address.
Default: Checked
show_cust_billing_address_field
Parameters
Boolean, Vendor ID
Snippet: Prevent vendor from seeing customer’s Billing Address.
add_filter ( 'show_cust_billing_address_field', '__return_false' );
Path of Setting
WCMp > Settings > Capabilities > Order
Description
Checked: Vendor can see Customer’s Shipping Address.
Default: Checked
show_cust_shipping_address_field
Parameters
Boolean, Vendor ID
Snippet: Prevent vendor from seeing customer’s Shipping Address.
'add_filter ( 'show_cust_shipping_address_field', '__return_false', );'
Path of Setting
WCMp > Settings > Capabilities > Miscellaneous
Description
Checked: Vendor can add their shop specific message in “Thank you” page and order mail.
Default: Checked
wcmp_display_vendor_message_to_buyer
Parameters
Vendor ID
Snippet: Prevent vendors from adding their own message in “Thank you” page and order mail.
add_filter ( 'wcmp_display_vendor_message_to_buyer', '__return_false');
Copy
There was no specific Setting for this capability. However, Vendor couldn’t view shipping address of the customer.
Default
Vendor can view shipping address of the customer.
is_vendor_can_see_order_shipping_address
Parameters
Boolean, Vendor ID
Snippet: Prevent vendor from viewing shipping address of the customer.
add_filter ( 'is_vendor_can_see_order_shipping_address', '__return_false' );
Copy
There was no specific Setting for this capability. However, Vendor couldn’t view billing address of the customer.
Default
Vendor can view billing address of the customer.
is_vendor_can_see_order_billing_address
Parameters
Boolean, Vendor ID
Snippet: Prevent vendor from viewing billing address of the customer.
add_filter ( 'is_vendor_can_see_order_billing_address', '__return_false' );
Copy
Default
Vendor can’t edit the title for a duplicate product.
wcmp_singleproductmultiseller_edit_product_title_disabled
Parameters
Boolean
Snippet: Allow vendor to edit Duplicate Product title.
add_filter ( 'wcmp_singleproductmultiseller_edit_product_title_disabled', '__return_false' );
Copy
Default
Vendor can see all the provided widgets. Currently, the widget list comprises of the following:
before_wcmp_dashboard_widget
Parameters
Widgets Array
Snippet: Remove widgets from vendor dashboard.
add_filter( 'before_wcmp_dashboard_widget', 'filter_before_wcmp_dashboard_widget', 10, 1 ); function filter_before_wcmp_dashboard_widget( $vendor_dashboard_widget ) { unset($vendor_dashboard_widget['full']['wcmp_vendor_stats_reports']); //remove Vendor Stats and Reports widget unset($vendor_dashboard_widget['side']['wcmp_vendor_transaction_details']); //remove Transaction Details widget unset($vendor_dashboard_widget['side']['wcmp_vendor_product_stats']); //remove Product Stats widget unset($vendor_dashboard_widget['side']['wcmp_vendor_products_cust_qna']); //remove Customer Questions widget unset($vendor_dashboard_widget['normal']['wcmp_vendor_visitors_map']); //remove Visitors Map widget unset($vendor_dashboard_widget['normal']['wcmp_vendor_pending_shipping']); //remove Pending Shipping widget unset($vendor_dashboard_widget['normal']['wcmp_vendor_product_sales_report']); //remove Product Sales Report widget unset($vendor_dashboard_widget['normal']['wcmp_customer_reviews']); //remove Customer Reviews widget return $vendor_dashboard_widget; }
Default
Vendor can see all the provided links. Currently, the important link list comprises of the following:
before_wcmp_dashboard_widget
Parameters
Widgets Array
Snippet: Remove widgets from vendor dashboard.
add_filter( 'wcmp_vendor_dashboard_header_nav', 'filter_wcmp_vendor_dashboard_header_nav', 10, 1 ); function filter_wcmp_vendor_dashboard_header_nav( $header_nav ) { unset($header_nav['shop-link']); //remove Vendor Shop Link unset($header_nav['add-product']); //remove Add Product Link unset($header_nav['announcement']); //remove Announcement Link unset($header_nav['withdrawal']); //remove Withdrawal Link return $header_nav; }
Copy
Default
Vendor’s social profiles are visible in the Vendor description of Vendor Shop.
wcmp_vendor_store_header_show_social_links
Parameters
Boolean, Vendor ID
Snippet: Hide vendor’s social profiles from Vendor Description.
add_filter( 'wcmp_vendor_store_header_show_social_links', '__return_false' );
Copy
add_action('wcmp_init', 'after_wcmp_init'); function after_wcmp_init() { // add a setting field to wcmp endpoint settings page add_action('settings_vendor_general_tab_options', 'add_custom_endpoint_option'); // save setting option for custom endpoint add_filter('settings_vendor_general_tab_new_input', 'save_custom_endpoint_option', 10, 2); // add custom endpoint add_filter('wcmp_endpoints_query_vars', 'add_wcmp_endpoints_query_vars'); // add custom menu to vendor dashboard add_filter('wcmp_vendor_dashboard_nav', 'add_tab_to_vendor_dashboard'); // display content of custom endpoint add_action('wcmp_vendor_dashboard_custom-wcmp-nenu_endpoint', 'custom_menu_endpoint_content'); } function add_custom_endpoint_option($settings_tab_options) { $settings_tab_options['sections']['wcmp_vendor_general_settings_endpoint_section']['fields']['wcmp_custom_vendor_endpoint'] = array('title' => __('Custom Menu', 'dc-woocommerce-multi-vendor'), 'type' => 'text', 'id' => 'wcmp_custom_vendor_endpoint', 'label_for' => 'wcmp_custom_vendor_endpoint', 'name' => 'wcmp_custom_vendor_endpoint', 'hints' => __('Set endpoint for custom menu page', 'dc-woocommerce-multi-vendor'), 'placeholder' => 'custom-wcmp-nenu'); return $settings_tab_options; } function save_custom_endpoint_option($new_input, $input) { if (isset($input['wcmp_custom_vendor_endpoint']) && !empty($input['wcmp_custom_vendor_endpoint'])) { $new_input['wcmp_custom_vendor_endpoint'] = sanitize_text_field($input['wcmp_custom_vendor_endpoint']); } return $new_input; } function add_wcmp_endpoints_query_vars($endpoints) { $endpoints['custom-wcmp-nenu'] = array( 'label' => __('Custom Menu', 'dc-woocommerce-multi-vendor'), 'endpoint' => get_wcmp_vendor_settings('wcmp_custom_vendor_endpoint', 'vendor', 'general', 'custom-wcmp-nenu') ); return $endpoints; } function add_tab_to_vendor_dashboard($nav) { $nav['custom_wcmp_nenu'] = array( 'label' => __('Custom Menu', 'dc-woocommerce-multi-vendor'), // menu label 'url' => wcmp_get_vendor_dashboard_endpoint_url('custom-wcmp-nenu'), // menu url 'capability' => true, // capability if any 'position' => 75, // position of the menu 'submenu' => array(), // submenu if any 'link_target' => '_self', 'nav_icon' => 'dashicons-admin-generic', // menu icon ); return $nav; } function custom_menu_endpoint_content(){ echo '<div class="wcmp_form1">'; echo '<p>Custom Menu content</p>'; echo '</div>'; }
Copy
Update wordpress Permalinks from Settings to prevent 404- Not Found error.
– When an order is created on the woocommerce end, we create the corresponding sub-order.
– Now, we check the initial order status of the order from woocommerce’s main order and set same order status for suborders too
– After that, each vendor/admin needs to change order status for each sub-order
– Therefore, apart from initial order status, if you change status of an order, this will not affect the sub order’s status
Now, you need to add some custom code to sync the parent order status with the sub orders:
P.S. Have more ideas to share or facing a hard to explain issue? Our quick support will definitely help you in the right direction… that’s a word you can trust.
Buy all Marketplace addons together!!
Check Slashed Price