How To Change The 「Wholesale Price: 」 Text On The Front End

How To Change The 「Wholesale Price: 」 Text On The Front End

One common thing people want to do is change the bit of text that shows before the price on your wholesale prices. This defaults to 「Wholesale Price:」
In the WooCommerce Wholesale Prices Premium plugin, you can change this text to anything you want. For example, Reseller Price.
You can find this option in WooCommerce > Settings > Wholesale Prices > Price > Wholesale Price Text.

If you have a multiple user role and would like to customize this text for each roles, you can use the following snippet:
add_filter('wwp_filter_wholesale_price_title_text', 'override_wholesale_text', 10, 1);

function override_wholesale_text($wholesaletext) {
global $current_user;

if (isset($current_user) && class_exists('WWP_Wholesale_Roles')) {
$wwp_wholesale_roles = WWP_Wholesale_Roles::getInstance();
$wwp_wholesale_role = $wwp_wholesale_roles->getUserWholesaleRole();

if (!empty($wwp_wholesale_role) && in_array('wholesale_customer', $wwp_wholesale_role)) {
// Where 'wholesale_customer' is the name of the wholesale role you want to target
return 'Wholesale Price:';
}

if (!empty($wwp_wholesale_role) && in_array('wholesale_vip', $wwp_wholesale_role)) {
// Where 'wholesale_vip' is the name of the wholesale role you want to target
return 'VIP Price:';

}

}
}

發表回覆

您的郵箱地址不會被公開。 必填項已用 * 標註