For the last few days I have been wrapping my head around this but for the life of me, can't figure out a way to do this.
I have a WordPress website dedicated to different categories of products. I use Custom Post Type UI to create the product categories, ACF for custom fields for each product type and then FacetWP for the indexing and filtering part. Each category has a dedicated catalogue style page where I have certain filters from FacetWP for users to narrow down their search for a product that fits their requirements.
Everything is working well, however, my issue is that some products get discontinued and are being replaced by newer versions. Because of this, I have added a custom field for each category such as "wm_manufactured" (washing machines) that has a simple check box with "Yes". If the checkbox is ticked, then I want the product to be displayed in the catalogue.
Does anyone know how to skip products or remove them from indexing if a certain field is empty or maybe another way of doing this?
I need these product pages to still be available through a direct link because they are being ranked high on Google and I have a banner informing customers that this particular product has been discontinued and have a link to its replacement.
CodePudding user response:
FacetWP has an addon that hide/shows results based on conditions. I think it could solve your problem.
CodePudding user response:
So I found the answer to my trouble and it was right in front of me. When making a "Listing" template in FacetWP, there is a second tab called Query. When I was testing the query filters, I was only putting the value that I set up on ACF, but the actual value that I had to add for the system to compare to was the exact figure from inside the database.
While ACF would have returned a "yes" for example, FacetWP was only seeing "a:1:{i:0;s:3:"yes";}", the value present in the database. So check the database for the exact value and don't just go based on what ACF will return.