Show only the regular price on shop page

Top WooCommerce & WordPress Plugins Forums Product Price by Quantity for WooCommerce Show only the regular price on shop page

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #92411
    Stefan
    Guest

    Is it possible to show only the regular price and not the sale price on shop page only for the wholesale products?

    #92412
    Tom Anbinder
    Moderator
    Plugin Support

    Hi Stefan,

    I don’t think we have an option for that in the plugin, however, if you are ok with adding a small PHP snippet, you can do it with this:

    if ( ! function_exists( 'my_alg_wc_wholesale_pricing' ) ) {
        /**
         * Replace sale price with the regular price on shop pages for wholesale products.
         */
        function my_alg_wc_wholesale_pricing( $price, $product ) {
            return (
                ( is_shop() || is_product_taxonomy() ) &&  // Viewing shop pages
                $product->is_on_sale() && // Product is on sale
                function_exists( 'alg_wc_wholesale_pricing' ) && // "Wholesale Pricing for WooCommerce" plugin is activated
                alg_wc_wholesale_pricing()->core->is_enabled( $product->get_id() ) // Wholesale pricing is enabled for the product
            ) ? wc_price( $product->get_regular_price() ) : $price;
        }
        add_action( 'woocommerce_get_price_html', 'my_alg_wc_wholesale_pricing', 10, 2 );
    }
    

    You can add this snippet to your (child) theme’s functions.php file.

    Please give it a try and let me know if you have any questions.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.