Support » Plugin: EDD Sale Price » How to detect sale products in a loop?

  • Resolved dkeeling

    (@dkeeling)


    Here’s an example that should illustrate the question:

    Say I have this installed and want to overlay a little banner that says “Sale!” over the product image. As I’m looping through the products, what functions/data are available to detect the sale item so I can add the banner?

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jeroen Sormani

    (@sormano)

    Hi,

    Probably best way to do that is just check the post meta to see if its set. At this moment there are no helper functions to help with that, but it is planned to add those in a future big update.

    Cheers,
    Jeroen

    dkeeling

    (@dkeeling)

    That works for me. Thank you!

    @sormano

    Just a quick update. I was able to do this successfully, but I thought I’d make a feature request for you to consider. It would be nice to be able to both detect sale items easily in the Loop and also be able to filter downloads to show only “on sale” items.

    It seems that the simplest solution would be to add a basic boolean custom field like “on_sale” that can be set on save_post. I may end up hooking into WP and adding that to my theme on my own, but it would be really convenient if it were added to the plugin itself.

    Thanks for creating the plugin — it works very well!

    • This reply was modified 1 month, 2 weeks ago by  dkeeling.
    Plugin Author Jeroen Sormani

    (@sormano)

    Thanks, I’ll take that with me when I’m working on a bigger update for the plugin 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.