Redirect when user tries to access page based on membership category AND Webflow CMS field

I know you can restrict certain pieces of content based on a URL, and also hiding / showing content on the page.

However, I would like to redirect users to a certain pages based on a CMS field.

i.e. I have a field in my Webflow CMS collection for ‘is bonus’ content.

If a user tries to access a webflow CMS item with this turned on, I want to redirect them to example.com/membership-required

I also now have multiple different membership IDs for different billing frequencies, so it would be something like:

if membership id in [‘x’,‘y’,‘z’] and “cms-bonus” = “true” redirect to /membership-required
else do nothing

I guess this is a simple piece of JS, but was just wondering if anyone had achieved the same thing.

I found this by @sumturner and it looks pretty close to what I’m trying to achieve.

Hey Alastair :wave:

I think you are already on the right track. I was actually going to link you to that forum post. :smiley: