Customizing Price Suffix for Wholesale Users in WooCommerce Wholesale Pro

WooCommerce Wholesale Pro Plugin from Barn2 is a powerful tool that allows users to set up a seamless wholesale experience on their WooCommerce store. In this article, we’ll explore how to change the suffix text in WooCommerce settings and provide a unique suffix for wholesale users.

Customizing the Suffix Text for Price Display:

You may deicde to show a tax included suffix in the WooCommerce settings, however, for wholesale users, you may want to show prices without tax to accommodate their specific needs. The following solution provides a code snippet that can be added to your child theme’s functions file or through a code snippets plugin.

function custom_woocommerce_get_price_suffix( $html, $product, $price, $qty ) {
    if ( class_exists( '\Barn2\Plugin\WC_Wholesale_Pro\Util' ) && \Barn2\Plugin\WC_Wholesale_Pro\Util::is_wholesale_user( wp_get_current_user() ) ) {
        $html = "no tax"; // Replace this with your desired suffix text
    }
    return $html;
}
add_filter( 'woocommerce_get_price_suffix', 'custom_woocommerce_get_price_suffix', 10, 4 );

Customizing the Suffix Text:

    Within the code snippet, locate the line: $html = "no tax"; and replace “no tax” with your preferred suffix text for wholesale users.

    Now, when a wholesale user views a product, the price suffix will be customized according to your specified text. For instance, a non-wholesale user might see “10$ inc tax,” while a wholesale user will see “10$ no tax.”

    This straightforward solution enhances the functionality of the WooCommerce Wholesale Pro Plugin, ensuring a tailored pricing experience for your wholesale customers.

    Leave a Comment

    Your email address will not be published. Required fields are marked *

    Scroll to Top