Home / Admin / Override Wholesale Price Text Per Wholesale Role
Duplicate Snippet

Embed Snippet on Your Site

Override Wholesale Price Text Per Wholesale Role

This snippet allows you to display specific wholesale price text for each of your wholesale roles

Code Preview
php
<?php
add_filter('wwp_filter_wholesale_price_title_text', 'wholesale_price_text', 10, 1);
function wholesale_price_text($text)
{
    global $wc_wholesale_prices;
    $user_wholesale_role = $wc_wholesale_prices->wwp_wholesale_roles->getUserWholesaleRole();
    if (!empty($user_wholesale_role)) {
        // To Switch wholesale price text depending on wholesale role
        switch ($user_wholesale_role[0]) {
            case 'wholesale_customer':
                return 'Wholesale Price:';
            // Add more role keys
            case 'wholesale_bronze':
                return 'Bronze Price:';
            case 'wholesale_gold':
                return 'Gold Price';
        }
    }
    return $text;
}

Comments

Add a Comment