Okay
  Public Ticket #3667047
Custom taxonomies for rules
Closed

Comments

  • Samuele started the conversation

    Hi there,

    I am evaluating your plugins (both B2B King and Sales Agent). However, it looks like you don't include any custom taxonomy when setting up rules, either for dynamic pricing or visibility, or even the 'request a quote' function.

    That would be very important to us as we had to manage our quite articulated catalog based on several custom taxonomies (e.g. brand, series, authors... – we are publishers).

    Would you consider adding this feature to a future release?

  •  2,214
    WebWizards replied

    Hello Samuele,

    Thank you for getting in touch with us,


    Currently visibility indeed does not support taxonomies.


    Regarding rules, B2BKing supports the "product_tag" taxonomy, it can be found at the bottom of the "applies to" table:

    5426539776.png

    If you would like, it is possible to change "product_tag" to a different taxonomy, using a code snippet. It can only be 1 taxonomy at the moment, so if you enable brands, you can no longer use tags for example.

    This is because the plugin uses some caching to determine which rules apply to which products, and the more taxonomies and options, the higher the effect on performance / load time. 

    This is still in beta and something we are working on improving. We would certainly like to have additional support for these in future versions.


    Kind regards,

    Stefan 

  •  2
    Matthew replied

    Hello Stephane,

    You reference a code snippet to show brands. 

    What is the code snippet to show "WooCommerce Brands" under the "Applies to" Section?

    Thanks

    Matt

  •  2,214
    WebWizards replied

    Hi Matt,

    Generally, you can use the following code to do that:

    add_filter('b2bking_dynamic_rules_taxonomy_option', function($taxonomy){
        return 'brand'; // set the name of your brand taxonomy here
    }, 10, 1);
    

    This code snippet can be added to functions.php, or by following our guide here: https://woocommerce-b2b-plugin.com/docs/how-to-add-a-snippet-php-or-js/



    In the above code snippet, you may need to change 'brand' to the actual name of the brand taxonomy on your site. It could be something like "pa_brand", "brands_xyz", etc. It depends on the plugin or code you are using to add support for brands.

    You may be able to find the taxonomy name by going to the site backend, to WooCommerce / Products -> Brands and checking the URL (e.g. for tags, the URL is edit-tags.php?taxonomy=product_tag, and the taxonomy is thus product_tag)

    Kind regards,

    Stefan