Some of the products on my page are time sensitive (events). Currently I am getting them all like this:

{% set events = craft.commerce.products.type('event').order('eventStartDate desc') %}

I can't use the expiryDate as the end date for my event, as I am keeping an archive that I want users to be able to click though. But, I don't want to include these "expired" events in my "upcoming events" list.

I am reading through this SO thread which I think is doing the same thing I am. It's painfully obvious that I don't know what I am doing though.

{% set today = now %}
{% set events = craft.commerce.products.type('event').eventEndDate('>= today') %}

: Call to a member function getTimestamp() on boolean

eventEndDate is a dateTime field type.

I am trying (and failing) to get all events that have an end date that is equal to, or before today. Once the event is over eventEndDate is after today, I do not want to show it in my list.

Thank you for any suggestions!

1 Answer 1


I think the only issue is that you're adding "today" to the query as a string, not the variable you've created. try:

{% set today = now %}
{% set events = craft.commerce.products.type('event').eventEndDate('>=' ~ today) %}

The code in the answer you referred to had the same error, I've fixed it.

  • ARGH. Pretty obvious now that you point it out. Thank you so much!
    – Damon
    Oct 30, 2016 at 21:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.