I’m trying to do some custom totals calculations in the cart. I’ve got these “Fees” but they are not cart-wide fees, they are per product fees. I’m able to add them to the cart item meta, but any line item calculations I try to do are overridden. Here is the code I have so far. I’ve tried updating the values using both woocommerce_before_calculate_totals and woocommerce_after_calculate_totals:
The weird thing is, the changes to cart meta stay but the total changes do not. This is something I can do, right? I know some of the cart properties must be updating using methods, but I did not see any for updating individual cart item properties beyond what I’ve done in my code.