Skip Navigation

[Resolved] Search filter based on repeatable field group

This support ticket is created 2 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 3 voices.

Last updated by javierP-9 2 years ago.

Assisted by: Luo Yang.

Author
Posts
#2484531

Hi again! Keep on working in my travel agency site and having issues with repeatable field groups. I have a custom post type for Tours and I've created a repeatable field group for this type with several departure dates and, in each of them, a checkbox to mark if that departure date is confirmed or not. This time the issue is using this info to filter the tours in a view.

In my front page I have a view showing all the tours. I added to this view a custom search filter based on different taxonomies and custom post fields, like where do you want to travel, price, duration, type of experience. I have no problem configuring all of these filters, but I have also a departure date filter. The departure date of each tour is set, as I mentioned before, with a repeatable field group. What I'm trying to do is create a departure date filter by month, so if the user selects "January" the view shows all of the tours that have set any departure date between 01/01/2023 and 10/31/2023. When I try to select de repeatable field "fecha de salida" to set the filter, it doesn't show up.

I've read several topics related filtering with repeatable field group but I couldn't find a solution. Is possible to do this?

Thanks in advance!

hidden link

#2485201

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

I'm sorry to say there isn't a good solution for what you want to do.

Repeatable Field Groups are implemented via hidden post relationships.

If you have a Tour post type and add a repeatable field group to it, the field values are not stored against the tour posts, but rather against a hidden custom post type that is a child of Tours.

When filtering Tours you can only filter by properties of Tours themselves (standard fields, custom fields, or taxonomies assigned to Tours), not by properties of another post type related to Tours.

It is an unfortunate omission, but it is a feature that has not been implemented.

It would require a custom solution to implement something like this. The first challenge is to include a filter control in the UI where users can select dates and then these chosen dates be passed along with the rest of the search submission.

You could then use the API to find the RFG posts that met the date conditions, find the Tour posts which they belong to, and then use the post__in WP_Query argument to limit the set of Tour posts that can be returned by the query.

It's not trivial, and is likely something you would need to hire a contractor to implement: https://toolset.com/contractors/

#2486201

Oh, it's sad to read that! I'll talk to my team to decide if we ask a contractor for assistance or if we try to change the tour data structuture to make possible to use the filter. Thank you for your time.

#2486629

Please update here if you still need assistance for it, thanks

#2488537

Sorry, thank you for your time