Knowledgebase
A+
A-

WCMp Hooks and Filters

WCMp has undergone a major makeover in version 3.0. On the admin front, WCMp has reduced its settings by nearly 40% while on the vendor side WCMp brought in an enhanced Vendor Dashboard.
Previously, WCMp offered 100+ settings and that created confusion among many users but that was never intended. Marketplace is a vast genre – and in order to offer even the minute flexibilities with not a line of code required, we ended up crossing the 100th mark! That was created to accommodate all types of marketplaces in one single plugin! When we decided to do away with the innumerous settings, we made sure it was still accessible. We’ve made it possible by adding hooks and filters, whose snippet you’ll find below. All you need to do is to paste it in your active theme and the setting you were longing for will work as you wished for!

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.

Filters for Admin Settings

Vendor Dashboard > Vendor Knowledgebase

Previous Setting

Path of Setting

WCMp > Settings > General > General

Description

Checked: Knowledgebase Menu appears on the Vendor Dashboard for vendors to access tutorials.

Versions > 3.0.0

Default: Checked

Corresponding Filter
See Source File
wcmp_vendor_dashboard_nav

Parameters

Vendor Dashboard Navigation Menus Array

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

Single Product Page > Policy Tab Title

Previous Setting

Path of Setting

WCMp > Settings > General > Policies

Description

Changes the policy tab title on the single product page.

Versions > 3.0.0

Default

Policies

Corresponding Filter
See Source File
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

Vendor Dashboard > Store Settings > Policies > Add / Edit policies

Previous Setting

Path of Setting

WCMp > Settings > General > Policies

Description

Checked: Vendors can edit Shipping, Refund, Cancellation / Return / Exchange Policies (as is the case).

Versions > 3.0.0

Default: Checked

Corresponding Filter
See Source File
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

Single Product Page > Policy Tab > Shipping Policy Title

Previous Setting

Path of Setting

WCMp > Settings > General > Policies

Description

Changes the shipping policy title on single product page under Policy tab.

Versions > 3.0.0

Default

Shipping Policy.

Corresponding Filter
See Source File
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

Single Product Page > Policy Tab > Refund Policy Title

Previous Setting

Path of Setting

WCMp > Settings > General > Policies

Description

Changes the refund policy title on single product page under Policy tab.

Versions > 3.0.0

Default

Refund Policy.

Corresponding Filter
See Source File
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

Single Product Page > Policy Tab > Cancellation / Return / Exchange Policy Title

Previous Setting

Path of Setting

WCMp > Settings > General > Policies

Description

Changes the cancellation / return / exchange policy title on single product page under Policy tab.

Versions > 3.0.0

Default

Cancellation / Return / Exchange Policy.

Corresponding Filter
See Source File
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

Vendor Dashboard > Store Settings > Policies > Customer Support Details

Previous Setting

Path of Setting

WCMp > Settings > General > Customer Support

Description

Checked: Vendors can add / edit vendor shop specific customer support details.

Versions > 3.0.0

Default: Checked

Corresponding Filter
See Source File
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

Shop Page > Sold by Text under Products

Previous Setting

Path of Setting

WCMp > Settings > Frontend

Description

Checked: Sold By text appears under products of shop page.

Versions > 3.0.0

Default: Checked

Corresponding Filter
See Source File
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

Cart and Checkout Page > Sold by Text under Products

Previous Setting

Path of Setting

WCMp > Settings > Frontend

Description

Checked: Sold By text appears under products of cart and checkout page.

Versions > 3.0.0

Default: Checked

Corresponding Filter
See Source File
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

Shop, Cart and Checkout page > Sold By Text

Previous Setting

Path of Setting

WCMp > Settings > Frontend

Description

Changes the sold by text that appears under products on shop, cart and checkout page.

Versions > 3.0.0

Default

Sold By.

Corresponding Filter
See Source File
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

Previous Setting

Path of Setting

WCMp > Settings > Frontend

Description

Show / Hide Report Abuse Link

Versions > 3.0.0

Default

Show

Corresponding Filter
See Source File
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

Single Product page > Report Abuse Link Text

Previous Setting

Path of Setting

WCMp > Settings > Frontend

Description

Change Report Abuse Link Text

Versions > 3.0.0

Default

Report Abuse

Corresponding Filter
See Source File
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

Vendor Shop Page > Blocked Vendor Text

Previous Setting

Path of Setting

WCMp > Settings > Frontend

Description

Change Blocked Vendor Text

Versions > 3.0.0

Default

Site Administrator has blocked this vendor

Corresponding Filter
See Source File
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

Vendor Dashboard > Orders > View Order > Comments

Previous Setting

Path of Setting

WCMp > Settings > Capabilities > Order

Description

Checked: Vendor can view order note added by the customer.

Versions > 3.0.0

Default: Checked

Corresponding Filter
See Source File
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

Vendor Dashboard > Orders > View Order > Add Comment

Previous Setting

Path of Setting

WCMp > Settings > Capabilities > Order

Description

Checked: Vendor can add order note.

Versions > 3.0.0

Default: Checked

Corresponding Filter
See Source File
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

Export Orders > Customer, Name, Email Contact

Previous Setting

Path of Setting

WCMp > Settings > Capabilities > Order

Description

Checked: Vendor can see customer’s name, email and contact details (as is the case).

Versions > 3.0.0

Default: Checked

Corresponding Filter
See Source File
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

Export Orders > Customer Billing address

Previous Setting

Path of Setting

WCMp > Settings > Capabilities > Order

Description

Checked: Vendor can see customer’s billing address.

Versions > 3.0.0

Default: Checked

Corresponding Filter
See Source File
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

Export Orders > Customer Shipping address

Previous Setting

Path of Setting

WCMp > Settings > Capabilities > Order

Description

Checked: Vendor can see customer’s shipping address.

Versions > 3.0.0

Default: Checked

Corresponding Filter
See Source File
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

Vendor Order Mail > Show Order Totals

Previous Setting

Path of Setting

WCMp > Settings > Capabilities > Order

Description

Checked: Vendor can see Customer’s order breakdown.

Versions > 3.0.0

Default: Checked

Corresponding Filter
See Source File
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

Vendor Order Mail > Customer Details

Previous Setting

Path of Setting

WCMp > Settings > Capabilities > Order

Description

Checked: Vendor can see Customer’s Email and Telephone.

Versions > 3.0.0

Default: Checked

Corresponding Filter
See Source File
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

Vendor Order Mail > Customer’s Billing Address

Previous Setting

Path of Setting

WCMp > Settings > Capabilities > Order

Description

Checked: Vendor can see Customer’s Billing Address.

Versions > 3.0.0

Default: Checked

Corresponding Filter
See Source File
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' );

Copy

Vendor Order Mail > Customer’s Shipping Address

Previous Setting

Path of Setting

WCMp > Settings > Capabilities > Order

Description

Checked: Vendor can see Customer’s Shipping Address.

Versions > 3.0.0

Default: Checked

Corresponding Filter
See Source File
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',  );

Copy

Store Settings > Storefront > Message to Buyers

Previous Setting

Path of Setting

WCMp > Settings > Capabilities > Miscellaneous

Description

Checked: Vendor can add their shop specific message in “Thank you” page and order mail.

Versions > 3.0.0

Default: Checked

Corresponding Filter
See Source File
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

Added Flexibilities on Vendor Capabilities

View Shipping Address (Previously unavailable)

Previous Setting

There was no specific Setting for this capability. However, Vendor couldn’t view shipping address of the customer.

Versions > 3.0.0

Default

Vendor can view shipping address of the customer.

Corresponding Filter
See Source File
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

View Billing Address (Previously unavailable)

Previous Setting

There was no specific Setting for this capability. However, Vendor couldn’t view billing address of the customer.

Versions > 3.0.0

Default

Vendor can view billing address of the customer.

Corresponding Filter
See Source File
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

Newly added Filters for Vendor Dashboard

Edit Product Title incase of Single Product Multiple Vendor

Default

Vendor can’t edit the title for a duplicate product.

Corresponding Filter
See Source File
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

Vendor Dashboard > Widgets

Default

Vendor can see all the provided widgets. Currently, the widget list comprises of the following:

  • Vendor Stats and Reports
  • Visitors Map
  • Transaction Details
  • Pending Shipping
  • Product Sales Reports
  • Product Stats
  • Customer Reviews
  • Customer Questions
Corresponding Filter
See Source File
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;
}

Copy

Vendor Dashboard > Links on top

Default

Vendor can see all the provided links. Currently, the important link list comprises of the following:

  • Vendor Shop
  • Add Product
  • Announcement
  • Withdrawal
Corresponding Filter
See Source File
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

Vendor Shop Page > Social Profile Links

Default

Vendor’s social profiles are visible in the Vendor description of Vendor Shop.

Corresponding Filter
See Source File
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 Custom Menu to Vendor Dashboard

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_ssection']['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.

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.

Was this helpful? Yes No