Filtering on custom field

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #105689
    Thrive Team
    Participant

    Hello,

    I have a custom field (advanced custom fields) that I want to filter the products by. The field is accessible and shows up in the XML feed when I use [alg_product_custom_field name=”sample_custom_field”].

    However, how can I filter the products that have values for “sample_custom_field”? I’ve tried putting that in the ‘custom taxonomy’ field to include, but no luck.

    I need to filter by this custom field for this plugin to work for us, thanks!

    • This topic was modified 1 year, 5 months ago by Omar Dabbas.
    #105690
    Thrive Team
    Participant

    I tried creating a new taxonomy, since that what it seems to really want. Not just a custom field. I was certain this would work… but it’s not.

    I registered a custom taxonomny:
    register_taxonomy(‘gundealtax’)

    I’m then using advanced custom fields to use that taxonomy to show fields on WooCommerce products. I populated 1 product with a ‘gundealtax’ taxonomy. I then place ‘gundealtax’ (without quotes) in the Custom taxonomy to include field, and it returns a list of all products, instead of 1.

    #105691
    Thrive Team
    Participant

    Darn, I updated my taxonomy code to:

    register_taxonomy( ‘gundealtaxonomy’, ‘product’, $args );
    register_taxonomy_for_object_type( ‘gundealtaxonomy’, ‘product’ );

    Seems to save the taxonomy values correctly through ACF. But placing neither the ACF field name “gun_deals_taxonomy” nor “gundealtaxonomny” works for filtering. So either I’m doing something very wrong… or the filtering by custom taxonmy doesn’t seem to wrok.

    #105692
    WPWhale
    Moderator

    Hello Thrive Team,
    Sorry to know you’re having a trouble using this feature.
    To create a feed based on a taxonomy (named color for example), you will need something like this:
    <size>[alg_product_terms taxonomy=”size”]</size>
    So now let’s assume you have 3 values for the size (S,M,L), and you want the XML feed to contain the products that have a value of S or M for the size taxonomy, you will need to enter ‘size’ (without quotes) in “Custom Taxonomy to Include”, and then enter ‘s,m’ in “Custom Taxonomy Slug” field.
    I’ve just applied the same exact steps and here is the XML file generated.
    The store has other products of course, but these two (appearing in the XML) are the only ones with small & medium values for that taxonomy (there is a product with large value, but not included in custom tax slugs so it’s not in the feed).
    I’ve used WCK plugin to create the taxonomy, while you used ACF, not sure if it could be an issue.
    If possible, grant me access to your store ([email protected]) I can take a look at the settings you have.
    Omar

    #105693
    Thrive Team
    Participant

    Hello, thanks for the reply but- I’ve already done exactly as you suggested- I placed the custom taxonomy field to include. I shouldn’t need to do anything further based on your documentation.

    In your example, you shouldn’t need to put in “M” or “S”. If you put in “size” as the attribute, it should grab all products WITH a size attribute. But nevertheless, I have put in the exact name of the attribute, it still doesn’t work.

    I’m not using ACF to create a custom taxonomy. I’ve created a custom taxonomy through standard WordPress register functions. The only thing ACF is being used for is to create an easy interface to select taxonomies. (You could add them in the sidebar via the standard wordpress method- makes no difference. The taxonomy is being saved correctly on the post, but the plugin cannot filter by it.)

    In my scenario, the custom taxonomy name is ‘gundealtaxonomy ‘and the attribute is ‘Ammunition’. When I put both of those into the settings as you have suggested like Size and S/M- it still produces an XML document with every product, whereas it should only be returning a single product since that’s all that is entered in the backend so far.

    How did you create the custom taxonomny Size, how did you populate it with data?

    I could give you access to a clone of the site, but i’ll need to create it first and I’ll also need a secure method of communication.

    #105694
    Thrive Team
    Participant

    Just saw you included your e-mail- I’ll get a clone set up so I can grant access.

    #105695
    WPWhale
    Moderator

    Hello again,

    I used WCK to create the taxonomy, and it allows you to create values from the product page itself.

    For communications, yes please contact me at that email .

    Omar

    #105696
    Greg
    Guest

    Omar- just sent you an email with Clone access and associated details!

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.