Home / How To Change The Wholesale Price Text On The Front End
Duplicate Snippet

Embed Snippet on Your Site

How To Change The Wholesale Price Text On The Front End

Customize the 'Wholesale Price:' text per user role - show different labels for different wholesale tiers

Code Preview
php
<?php
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:';
        }
    }
}

Comments

Add a Comment