I had what I thought was a very simple issue: Select some categories on the front-end, filtering by a Checkbox field.

The Checkbox has values, which correlate to Locales.

The end goal was to create a 'workaround' to the fact that you can't disable/enable a category per Locale.

So on the template, I attempted:

{% for collection in craft.categories.group('dressCollection').regionAvailability(craft.locale) %}

But that doesn't work.

1 Answer 1


Reply via Brandon:

A single field does probably make more sense here, as you have it.

You're close to getting it working, but your syntax for filtering categories based on craft.locale is wrong. Checkboxes fields store the selected option values as JSON, so if you check your craft_content table you will find values like


When you do this:


it is looking for a row where the regionAvailability value is equal to craft.locale. Even if only a single locale is checked, its value would still be ["locale_id"], not just locale_id.

So to fix this just change that parameter to:




(both do the same thing; just pick the one you think is more clear)

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.