Sale price

This topic contains 12 replies, has 2 voices, and was last updated by mehul2700 mehul2700 4 years, 11 months ago.

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #17018
    mehul2700
    mehul2700
    Participant

    I would like to know if there is away to show the sale price (discounted) in the search bar. I tried adding it in the advanced title field as mentioned in the knowledge base. However I do not use the sale price from woocommerce field and it use a plugin to show the discount on all my products.

    Is there any {} code that I can use similar to {_sale_price} that I can use from the plugin?

    #17021
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    It could be possible, but first I will have to know how those discount prices are stored. If it is some sort of custom field, then the advanced title field could work, but you will need to know the custom field name for that.

    If it is something else, or there is a different way to get those prices, a custom code could still be possible to construct to get them.

    Best,
    Ernest Marcinko

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


    #17026
    mehul2700
    mehul2700
    Participant

    What would you need to solve this?

    #17027
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

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


    #17029
    mehul2700
    mehul2700
    Participant

    I have attached the plugin that I use.

    Hope this helps.

    WooCommerce simple storewide sale

    #17030
    mehul2700
    mehul2700
    Participant

    Attached zip

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

    Hi!

    Thank you very much for it, I have looked through the source code.

    I have found a possible solution, but I am not sure I recommend using it. Let me explain. The plugin uses a very special method to apply the sales to the products. Basically it sets a temporary variable (transient) with the on-sale products to the currently listed page, and then uses this variable to check if any of the listed items are on sale. There is no function/method within the plugin that is able to check if an item is on a global sale based on the product only, as it also requires this page transient to be present.

    I had to extract these two functions from the plugin to a separate function, and also create a filter to add the ‘fixed’ price to the results list. Please use this solution with caution, it may not work in all cases.

    Add this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!

    Best,
    Ernest Marcinko

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


    #17038
    mehul2700
    mehul2700
    Participant

    Hi,

    Ernest, thank you so much for working on the custom code. You are a gem.

    I copied the code as you mentioned in the functions.php file, however, the ajax search spinning wheel seems to be spinning and the search has stopped. Any other configs we need to do in the backend?

    #17040
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    Make sure that the code is copied correctly (from line 3 only). If you want, you can add temporary FTP access, and I will check it for you.

    Best,
    Ernest Marcinko

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


    #17043
    mehul2700
    mehul2700
    Participant
    You cannot access this content.
    #17053
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    Unfortunately I am not able to log-in via FTP with these details, my client says that either the username or password is incorrect. Can you please check that? If I need a special configuration in my FTP client, let me know.
    Thank you!

    Best,
    Ernest Marcinko

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


    #22183
    mehul2700
    mehul2700
    Participant
    You cannot access this content.
    #22184
    mehul2700
    mehul2700
    Participant
    You cannot access this content.
Viewing 13 posts - 1 through 13 (of 13 total)

The topic ‘Sale price’ is closed to new replies.