Forums › Forums › Search & Filter Pro › Working With Woocommerce
Tagged: woocommerce
- This topic has 4 replies, 3 voices, and was last updated 9 years, 7 months ago by Anonymous.
-
Anonymous(Private) July 14, 2014 at 8:45 pm #2485
I can’t seem to find any documentation on using this plugin with WooCommerce. The very basic search feature works, but I need some guidance on adding filtering for product attributes. Where do you find the values? Do you need to pre-load all values? etc.
Thanks
Ross Moderator(Private) July 14, 2014 at 10:35 pm #2495Hey Robert, its pretty much the same as everything else, WooCommerce uses custom taxonomies for categories and tags so you just need to use taxonomy fields to display those.
If you have other attributes, then these will be post meta – however these do not work the same as taxonomies or categories for example, they require a bit more setting up.
First you’ll need to find the meta key that is used for the values you want to search, so for example if I wanted to add a field for price, then I would add a
post meta
field to my search form UI, and then I would choose_price
as the meta key. Depending on how you want to display it you might choose a range slider, so I would choose the number type and the range slider.If you’re not sure what the meta key is for the attribute you want to search, then I think the easiest way of figuring that out is to do a dump of your post meta. You could add the following in your loop in one of your templates to get a list of all meta keys / values for a specific post or a page of posts:
<?php $post_meta = get_post_meta( get_the_ID() ); echo '<pre>'; var_dump($post_meta); echo '</pre>'; ?>
Does that make sense?
Ross Moderator(Private) July 14, 2014 at 10:36 pm #2496Sorry just to add.. if you are looking to do a dropdown or another input type other than number with post meta, then you will need to preload all the values and enter labels for them – use the “auto suggest” feature to auto detect values that are currently in use and populate your field with options for your users.
Thanks
Anonymous(Private) April 28, 2015 at 7:38 pm #16091Hi Ross,
I’m a newbie and trying to use the search-form on adapted woocommerce products. I’ve added about 20 new product attributes but I can’t find their meta-key identifier in the post-meta building block. Their is a huge list of meta-keys but the ones I defined aren’t there. How can I find those new product-attribute meta-keys?
Thx
-
AuthorPosts