This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Search preview shows sales prices for items that don't have a sale price

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Search preview shows sales prices for items that don't have a sale price Reply To: Search preview shows sales prices for items that don't have a sale price

#40946
Ernest MarcinkoErnest Marcinko
Keymaster

Okay, that is more likely a bundle type and not a variable product. I don’t know why WooCommerce reports incorrect prices to them. As far as I know, the bundle addition is an official WooCommerce plugin, so it should work, but maybe it is more complicated for bundled items.

Please let me know if you find anything. If it helps your developer, our plugin uses the following code to fetch the prices:

if ( $p->is_type('variable') && $field != '_sale_price' ) {
	$price = $p->get_price_html();
} else {
	switch ($field) {
		case '_regular_price':
			$price = $p->get_regular_price();
			break;
		case '_sale_price':
			$price = $p->get_sale_price();
			break;
		case '_tax_price':
			$price = wc_get_price_including_tax($p);
			break;
		case '_price_html':
			$price = $p->get_price_html();
			break;
		default:
			$price = $p->get_price();
			break;
	}
	if ( $field != '_price_html' && $price != '' ) {
		if ($currency != '')
			$price = wc_price($price, array('currency' => $currency));
		else
			$price = wc_price($price);
	}
}

This is basically it. In theory this should return the correct price for a product with a formatted currency symbol.