Hi, if I use the B2BKing plug-in in WooCommerce, are the configuration settings/properties of the plug-in exposed via API? (For example, I could use API requests to set a discount amount and configure which users/roles have that discount? Or can those things only be configured via the UI?). Thanks, Craig
Yes, all B2BKing data is standard WordPress data (posts, post meta, user meta), so it's possible to set values via either the WP API or the WooCommerce API.
Feel free to send us specific details about your setup - what kind of discount you need, how many users, how many products, how many different rules or configs, etc. We'd be happy to advise on the best approach for simplicity and performance.
Hi, if I use the B2BKing plug-in in WooCommerce, are the configuration settings/properties of the plug-in exposed via API? (For example, I could use API requests to set a discount amount and configure which users/roles have that discount? Or can those things only be configured via the UI?). Thanks, Craig
Hi Craig,
Thanks for getting in touch!
Yes, all B2BKing data is standard WordPress data (posts, post meta, user meta), so it's possible to set values via either the WP API or the WooCommerce API.
Regarding your questions:
B2BKing uses its own groups instead of roles. You can assign a group programmatically for each user, which determines what discount they get: https://woocommerce-b2b-plugin.com/docs/how-to-set-user-group-programmatically-during-import-in-bulk-with-scripts/
Group prices are stored as postmeta, so you can set those with a POST API request for each product.
There are a few more options depending on your needs:
1. B2BKing has dynamic rules that can be set via API: https://woocommerce-b2b-plugin.com/docs/import-or-setup-dynamic-rules-programatically/
2. You can also set prices directly for each user (by username or user ID) via metadata: https://woocommerce-b2b-plugin.com/docs/release-1-8-0-price-lists-csv-import-export-pricing-in-the-product-page/
Feel free to send us specific details about your setup - what kind of discount you need, how many users, how many products, how many different rules or configs, etc. We'd be happy to advise on the best approach for simplicity and performance.
Kind regards,
Stefan