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 1 year, 3 months ago.
- AuthorPosts
- January 13, 2023 at 1:14 pm #40898
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,
TomAttachments:
You must be logged in to view attached files.January 13, 2023 at 1:38 pm #40901Hi,
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 :)
January 14, 2023 at 8:00 pm #40909Thank 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 🙂
January 16, 2023 at 12:33 pm #40914Sure!
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 :)
January 16, 2023 at 12:48 pm #40917Thank you, Ernest! I will play around with this.
January 16, 2023 at 3:47 pm #40921Hi 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.January 16, 2023 at 5:20 pm #40924Okay. 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
Best,
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.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
January 16, 2023 at 6:51 pm #40928Thank 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,
TomJanuary 17, 2023 at 10:22 am #40938Unfortunately 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 :)
January 17, 2023 at 10:27 am #40940Hi 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.
January 17, 2023 at 10:38 am #40943Okay, 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 :)
January 17, 2023 at 10:56 am #40945No, it seems to be on products that are available as options on other product bundles.
For example this product:
https://www.wildguitars.co.il/product/positive-grid-spark/Is available as an optional upgrade in all of these guitar bundles:
https://www.wildguitars.co.il/product-category/גיטרות/גיטרות-חשמליות/חבילות-גיטרה-חשמלית-ומגבר/January 17, 2023 at 11:04 am #40946Okay, 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 :)
January 17, 2023 at 7:26 pm #40949Thanks so much for this, Ernest, I will be sure to share it with our developer.
- AuthorPosts
You must be logged in to reply to this topic.