Forums Forums Search & Filter Pro Working With Woocommerce

Tagged: 

Viewing 5 posts - 1 through 5 (of 5 total)
  • Anonymous
    #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
    #2495

    Hey 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
    #2496

    Sorry 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
    #16091

    Hi 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

    Anonymous
    #16097

    Product attribute meta-keys are available in Taxonomy S&F form once the “Enable archive” tick-box is selected. So this issue is solved for me!

Viewing 5 posts - 1 through 5 (of 5 total)