Hello,
I want to filter a product in woocommerce based on a custom field group (weekly_deal) I created. If the checkbox is set, I want to build a query loop, to display the product on the homepage. It seems rather simple to me, but I cannot get it to work.
I cannot get the filter to work though to display the product. there will only be one product at a time with this checkbox set.
I know how to create query loops for custom post types, and that works well, but I never built a loop around a specific field to be set
I set the feature image, but I this is not the correct product being displayed. This one also has not set the flag, so I assume it is feeding in, because of the template settings to use all products.
Your meta key would be {weekly_deal} and for value, depending on what the checkbox field has as input. 0 or 1, true or false
So meta key should check out to be equal to true (or 1)
For using the correct meta key, sometimes they are without the { } signs. Not sure why and i don’t use metabox but stick to acf. Weird it has no dynamic data input.
To see the checkbox value, try outputting it in a text field.
For the meta query thing,
Meta key goes without the { } signs
See meta query as a more advance filter on your normal query
If you use this to compare against another field, it does require { } for meta value.
About the data selector: Though the dynamic data selector had this : {acpt_product_weekly-deal-config_weekly-deal}
I think its a metabox thing.
Acf just has it as a unordered list, while metabox sort of uses a breadcrumb type like selector.
In this case I am using ACPT, but I would assume, that doesn’t make a big difference? Yep all are in the same posttype (products).
For the taxonomy it worked perfectly with the “add terms include” field. Now it shols the product. THough I would assume, this should be able to be replicated also with the field group and a meta query