Is it possible to create a Dynamic Rule that applies a percentage discount on Brands of my choice for customers of my choice?
WooCommerce supports Brands, but I can't make B2BKing fetch those brands in the dropdown. It will only find "Brands" that I've made as an actual Product Category. My list of actual Brands is plentiful, but B2BKing does not fetch those.
Wanted to add some more documentation. You see here I have actual Brands from WooCommerce, and I have a Product Category named Brands. B2BKing only fetches a bit of my Product Category named Brands (not even all of them).
Let me walk you through the proper way to configure this:
First, please go to B2BKing → Settings → Other and make sure to enable "Dynamic rules: Search by AJAX".
Then when configuring a rule, choose "Search for items..." under the "Applies to" dropdown. This search feature will show ALL categories, brands, and tags. The other option you were using is only for quick selection and may not show everything when you have many items on your site.
Now, regarding WooCommerce Brands specifically, please add this PHP code snippet to your site (you can add it to functions.php of your theme or use any code snippets plugin):
This snippet will replace the tags option with your WooCommerce Brands under the "Search for items..." area. Make sure to click on the Brands checkbox first when searching: https://prnt.sc/33U5sHB5powf
That was very thorough and straight to the point. Your suggestions on how to use the plugin, but also the snippet works great. Thank you for your help, you can now close the case.
I'm terribly sorry for necroing this thread. I spoke ahead of myself when I said it worked great. I just tried testing if I could select Brands, and that much was true. I am sorry for leading you on like that.
I've followed your documented method to enable brand targeting via filters:
Thanks for the follow-up and no worries about reopening this.
The "Brands" option that appears when you add that code snippet actually replaces the "Tags" option - it's not related to the Categories/Products selections. Those remain separate.
The brands functionality should be fully supported wherever tags were supported - it just replaces that option.
That said, based on what you're describing with the saving behavior, I'd like to take a closer look to make sure everything is configured correctly on your specific setup. If you'd like, we can also troubleshoot this directly on the site. For that, we would need a backend login to the site or a staging clone site.
I've made a few changes that should resolve the issue:
(1) There was indeed a display issue with the brands functionality. I've updated B2BKing with a fix on your site. The plugin now also supports brands natively without needing that code snippet, so I've removed it for you.
(2) I noticed that in B2BKing → Settings → Other → Components, several B2BKing discount types were disabled: https://prnt.sc/Jli3lrkmFbtG
I've re-enabled "Disable dynamic rule discounts as sale price" so that this rule type works. Please note that if other discount rules aren't working in the future, it may be because their components are disabled in this section.
(4) One important thing to note: your site has both "Discount Rules for WooCommerce" and "Discount Rules PRO 2.0" installed. We recommend not using these plugins alongside B2BKing for pricing and discounts. Either those plugins or B2BKing should handle discounts, but not both at the same time, as this can lead to conflicts.
Let me know if everything is working as expected now!
Hello,
Is it possible to create a Dynamic Rule that applies a percentage discount on Brands of my choice for customers of my choice?
WooCommerce supports Brands, but I can't make B2BKing fetch those brands in the dropdown. It will only find "Brands" that I've made as an actual Product Category. My list of actual Brands is plentiful, but B2BKing does not fetch those.
Attached files: b2bking.jpg
Wanted to add some more documentation. You see here I have actual Brands from WooCommerce, and I have a Product Category named Brands. B2BKing only fetches a bit of my Product Category named Brands (not even all of them).
Attached files: B2BKing2.png
B2bKing3.png
Hi Michael,
Thank you for purchasing our plugin,
Let me walk you through the proper way to configure this:
First, please go to B2BKing → Settings → Other and make sure to enable "Dynamic rules: Search by AJAX".
Then when configuring a rule, choose "Search for items..." under the "Applies to" dropdown. This search feature will show ALL categories, brands, and tags. The other option you were using is only for quick selection and may not show everything when you have many items on your site.
Now, regarding WooCommerce Brands specifically, please add this PHP code snippet to your site (you can add it to functions.php of your theme or use any code snippets plugin):
This snippet will replace the tags option with your WooCommerce Brands under the "Search for items..." area. Make sure to click on the Brands checkbox first when searching: https://prnt.sc/33U5sHB5powf
I've recorded a quick video to show you how this should work: https://www.loom.com/share/781017582c204dd1a50053af99897b7f?sid=fbcf4ea8-4baf-491e-9ba8-8b99b150202d
Let me know if you need any clarification on the setup,
Kind regards,
Stefan
That was very thorough and straight to the point. Your suggestions on how to use the plugin, but also the snippet works great. Thank you for your help, you can now close the case.
Thanks for the update, that's great to hear!
If you run into any other issues or anything we can help with, please let us know.
Kind regards,
Stefan
Hi Stefan,
I'm terribly sorry for necroing this thread. I spoke ahead of myself when I said it worked great. I just tried testing if I could select Brands, and that much was true. I am sorry for leading you on like that.
I've followed your documented method to enable brand targeting via filters:
add_filter('b2bking_dynamic_rules_taxonomy_option', function($val){
return 'product_brand'; // Using WooCommerce’s default brand taxonomy
}, 10, 1);
add_filter('b2bking_custom_taxonomy_backend_name', function($name){
return 'Brands';
}, 10, 1);
This allows me to:
See “Brands” in the rule editor
Search and select a brand (e.g., “2-BE”)
Save the rule with Brands selected
However, after saving:
The rule flips back to “Products” and “Categories”
“Brands” is unchecked
My selected brand disappears
Debug output shows that b2bking_custom_taxonomy_terms is not saved at all in post meta
I’ve confirmed the following:
product_brand taxonomy exists and is detected correctly
“Replace product dropdown” is disabled
No caching is interfering (B2BKing plugin cache cleared)
I’m running B2BKing PRO version 5.4.20
It seems like the UI works at selection time, but the rule editor does not persist or save brand term selections.
Can you please confirm:
Is product_brand fully supported in dynamic rules?
Is there anything additional I need to do to get terms under that taxonomy to save and reload?
Could the save logic be defaulting to Categories or Products if the radio selection is not retained?
Hi Michael,
Thanks for the follow-up and no worries about reopening this.
The "Brands" option that appears when you add that code snippet actually replaces the "Tags" option - it's not related to the Categories/Products selections. Those remain separate.
The brands functionality should be fully supported wherever tags were supported - it just replaces that option.
That said, based on what you're describing with the saving behavior, I'd like to take a closer look to make sure everything is configured correctly on your specific setup. If you'd like, we can also troubleshoot this directly on the site. For that, we would need a backend login to the site or a staging clone site.
Kind regards,
Stefan
Hi Michael,
Thanks for the login details!
I've made a few changes that should resolve the issue:
(1) There was indeed a display issue with the brands functionality. I've updated B2BKing with a fix on your site. The plugin now also supports brands natively without needing that code snippet, so I've removed it for you.
(2) I noticed that in B2BKing → Settings → Other → Components, several B2BKing discount types were disabled: https://prnt.sc/Jli3lrkmFbtG
I've re-enabled "Disable dynamic rule discounts as sale price" so that this rule type works. Please note that if other discount rules aren't working in the future, it may be because their components are disabled in this section.
(3) The brand discount rules should be working now. I've recorded a quick video showing an example: https://www.loom.com/share/6883a93d310040bba7b07cad804306c5
(4) One important thing to note: your site has both "Discount Rules for WooCommerce" and "Discount Rules PRO 2.0" installed. We recommend not using these plugins alongside B2BKing for pricing and discounts. Either those plugins or B2BKing should handle discounts, but not both at the same time, as this can lead to conflicts.
Let me know if everything is working as expected now!
Kind regards,
Stefan