Display Regular and Sale Prices on Manual WooCommerce Orders

My wife often manually generates orders for her customers and sends them a payment link by email. On the front end of the site, she displays the regular (list) price for each product along with her price which she inputs as the sale price.

When someone purchases cabinets using the front-end of her site, this works well. They see the regular price and the discounted one as they add items to their cart. However, when she creates an order via the back-end of the site, the customer never sees the regular prices so they’re not as aware of just how much they are saving.

So she needed a way to show the sale price and the regular price on order invoices. Thankfully, WooCommerce has a filter that’s used when a product is added to the cart via AJAX on the admin side. We’re able to use it to change the pricing. Here’s the snippet that enables the change.

function ijab_add_regular_price_order_items( $item, $item_id, $order, $product ) {

	foreach ( $order->get_items() as $item_id => $item ) {
		$product_id = $item->get_product_id();
		$product    = wc_get_product( $product_id );
		$item->set_subtotal( $product->get_regular_price() );


	return $item;

add_filter( 'woocommerce_ajax_order_item', 'ijab_add_regular_price_order_items', 10, 4 );

Just like that, her invoices clearly show the discounts that she’s giving on each order. It’s just one of the many amazing things that you can do with WordPress filters and actions.

Leave a Reply

%d bloggers like this: