
The plugin does not show regular prices but one developer wanted to see them.
Last year I wrote about only showing the sale price, instead of the sale and regular price. A use case could be for a wholesaler customer who may not be interested in the regular price. Late last month Lyse commented on the gist looking to display both prices on the cart and checkout pages. She is using the WooCommerce Wholesale Prices plugin.
Set Wholesale Prices
I installed the plugin on a local install and created a wholesale user. The wholesale price is set in the same section as regular prices.


Front End Price Display
On the front end the prices display similar to sale prices, with the regular price with a line through (via the <del> tag). The regular price is shown in the shop, category and single product views but not in the checkout or cart. This is where Lyse wanted the regular prices shown.

Retrieve Regular Price
The plugin support team suggested looking at the ‘woocommerce_cart_item_price‘ and ‘woocommerce_cart_item_subtotal‘ filters. I created a small pluging and used error_log() and var_export() to examine the data coming through those filters.
After stepping through the code with Visual Studio Code and Xdebug I noticed that calling the product member function get_price() was returning the wholesale price instead of the regular price. While debugging I saw that WooCommerce maintains a list of product member variables that have been changed (like the price in this instance) and returns those over the original values!! As a result I have to use the product ID to create a new product instance and get the regular price from that. For variable products I used the variation ID to create the new product instance.
For the product subtotal I used the quantity to calculate the regular price subtotal.
I didn’t extend this to show the cart subtotal regular and discounted amounts though it would not be too difficult: loop through the cart items and use the product subtotal code and sum the amounts.


I’m Lyse the individual who was looking for customization to display both regular and wholesale prices in the cart and checkout pages for one of my client’s website. Damien has done a terrific work in adding this functionality to the Wholesale Suite plugin. He’s was incredibly fast and accurate in providing the code necessary to accomplish this. Thank you Damien!
Thanks for the kind words. I got to learn about WooCommerce caching changed product member variables.