Hi B2BKing Support,
I’m using the B2BKing plugin and have run into some performance issues identified with the Query Monitor plugin. I’ve noticed that many of the plugin’s database queries are being executed multiple times per page load, especially those related to product visibility rules and custom fields.
Examples of repeated queries:
-
SELECT * FROM wp_postmeta WHERE meta_key = 'b2bking_rule_who' ...
-
SELECT d_posts.ID FROM wp_posts ... WHERE post_type = 'b2bking_rule' ...
-
WC_Product_Data_Store_CPT->get_product_id_by_sku repeated multiple times
-
Multiple LIKE-based meta queries involving visibility groups
These queries appear to be repeated across various components like:
-
b2bking_product_categories_visibility_rules_productfilter
-
b2bking_disable_payment_methods_dynamic_rule
-
b2bking_get_rules_for_user
They significantly impact performance on product and checkout pages.
Questions:
-
Is there a way to optimize or cache these queries?
-
Could you recommend hooks or filters that allow me to cache rules per user/session using transients or object cache?
-
Are there known strategies for minimizing the number of visibility or rule queries per request?
Thanks in advance for any performance guidance or optimizations you can recommend.
Best regards,


