Price calculation issue if product price is changed by another plugin
Hello,
I am trying to use your plugin in addition with another plugin that allow to set bulk prices based on quantities. For instance, base product price is 20$. But if the customer adds 10 products, the prices will be 18$.
Unfortunately, when using your plugin, this feature is not working anymore. When I try to add an addon price of 5$ to my product, the total price is always calculated based on the product base price (20$ + 5$). Even if I add more than 10 products to my cart.
Any chance that you could fix this?
As far as I understand your code, you pass the product/attribute data to the ExpressionParser. At this moment, the product price has not been calculated using woocommerce hooks that others plugins can rely on. Not sure if you can trigger the calculation of the product price using hooks at this moment and add calculate the new price based on this calculated price.
FYI, the second module I use is recalculating product prices using the woocommerce_before_calculate_totals since the price might change based on other products quantities.
Your module is using woocommerce_add_cart_item_data hook to calculate price, and then, woocommerce_before_calculate_totals to update the price.
You may need to move your price calculation logic into woocommerce_before_calculate_totals.
Not sure if I will be able to work on this, but if I can, do you accept pull requests?