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

This topic contains 13 replies, has 2 voices, and was last updated by wildguitars06 wildguitars06 3 weeks ago.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #40898
    wildguitars06
    wildguitars06
    Participant

    Hello Ernest, I hope you’re doing well and that your year has started off with a bang!

    We’ve received a few complaints from customers that our website is showing incorrect sale prices. Upon further inspection, the issue seems to be only with the search preview and only on mobile. Please see the attached screenshot of a search for “spark”.

    The three products with a sale price in the screenshot do not actually have a sale price if you visit their individual pages. BUT, they ARE offered at these prices when purchasing them as bundle additions with other products.

    You can see these bundle options here:
    https://www.wildguitars.co.il/product/positive-grid-spark-mini/
    https://www.wildguitars.co.il/product/positive-grid-spark-pearl/
    https://www.wildguitars.co.il/product/sterling-ct50hss-pack/

    So, for some reason the search preview is showing the price of these items when purchasing them as a bundle with other items.

    Do you have any idea why this is happening?

    Best regards,
    Tom

    Attachments:
    You must be logged in to view attached files.
    #40901
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Thank you for the details, it helps a lot!

    When I try the same search, I am not getting that output: https://i.imgur.com/tjcmRlM.png
    You may have had those results cached from a previous pricing (?), but I am not sure. The prices are directly requested from WooCommerce, the plugin does not change anything in regards for the price.

    I recommend trying the following variable for the advanced title/content fields instead of using the regular/sale versions:

    {_price_html}

    ..or simply the:

    {_price}

    By default WooCoomerce should include the sale and the regular prices for these fields automatically.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #40909
    wildguitars06
    wildguitars06
    Participant

    Thank you for your prompt rely, Ernest! Perhaps you can point out where I can change these variables? I’m having a bit of difficulty locating it 🙂

    #40914
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Sure!

    You can change them at the advanced title and content fields.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #40917
    wildguitars06
    wildguitars06
    Participant

    Thank you, Ernest! I will play around with this.

    #40921
    wildguitars06
    wildguitars06
    Participant

    Hi Ernest, I made the recommended change but I still see the issue – now on desktop search as well.
    Please see the attached screenshot; you can see that the Spark amplifier has a 790₪ sale price. This item has no sale price configured, but it as available as a 790₪ upgrade in another bundle product.

    Attachments:
    You must be logged in to view attached files.
    #40924
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Okay. I have checked the shop results page too, but there seems to be an issue with that price, as it is incorrectly reported there too: https://i.imgur.com/gvYuvDJ.png
    The plugin only requests these values from WooCommerce directly, and as you can see, the same issue is present there. The price is very likely changed on conditions via a 3rd party hook (maybe plugin?) and very likely depends on the actual environment.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #40928
    wildguitars06
    wildguitars06
    Participant

    Thank you for looking into this, Ernest. While I agree that it’s odd that the product has a sale price that is identical to the regular price in the search results page, in the search preview window it has a price of 790₪ that is of course incorrect. I’m sure this is affected by a third-party plugin but I was hoping we could “force” the correct price to display in the preview. I will do some more research.

    Best regards,
    Tom

    #40938
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Unfortunately I don’t know if there is any way. I mean there should be, but requesting the product price from WooCommerce should always return the same output. What’s interesting is, that on the search results page and on the main page these values are different, so I am only guessing for some sort of conflict.

    Do you use by any chance WPML and Multi currency values for prices? That may affect the output somewhat, in that case maybe we can try experimenting with custom codes.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #40940
    wildguitars06
    wildguitars06
    Participant

    Hi Ernest, I do not use either of these plugins. I will ask our web developer to check if he can find out why the search results are showing such odd prices.

    #40943
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Okay, one more question, are these problematic prices showing at variable products by any chance?

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #40945
    wildguitars06
    wildguitars06
    Participant
    #40946
    Ernest Marcinko
    Ernest 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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #40949
    wildguitars06
    wildguitars06
    Participant

    Thanks so much for this, Ernest, I will be sure to share it with our developer.

Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.