Describe the bug
In functions.php i got simple cart discount function using 'woocommerce_before_calculate_totals' hook. It applies negative fee to cart when specific criteria are met within cart.
Querying cart returns those fees when front end cart meets those critiria, but when mutating - ex. adding item which should make such fee occur - doesn't (mutations returns fees: null). Subsequent querying cart properly fetches fees property.
To Reproduce
Steps to reproduce the behavior:
Add discount function to theme functions.php file. Simplified example -> 20% discount when 4 or more products in cart:
Expected behavior
Mutation response fees array as query.
Additional Info
I don't think it has anything to do with used woocommerce hook -> meaning that the fee calculation happens after response of mutation. Mostly because where I have more than enough products in cart with calculated fee and removing item while still maintaining minimal productCount the response still nulls fees array.
Desktop (please complete the following information):
OS: Windows 11
Browser MS Edge
Version 92
Plugin Versions
WooGraphQL Version: 0.10.3
WPGraphQL Version: 1.6.3
WordPress Version: 5.8
WooCommerce Version: 5.5.2
Describe the bug In functions.php i got simple cart discount function using 'woocommerce_before_calculate_totals' hook. It applies negative fee to cart when specific criteria are met within cart.
Querying cart returns those fees when front end cart meets those critiria, but when mutating - ex. adding item which should make such fee occur - doesn't (mutations returns fees: null). Subsequent querying cart properly fetches fees property.
To Reproduce Steps to reproduce the behavior:
Fill cart with items so fee will be applied
Query in Graphiql like:
mutate cart with either addToCart
or removeItemsFromCart
Expected behavior Mutation response fees array as query.
Additional Info I don't think it has anything to do with used woocommerce hook -> meaning that the fee calculation happens after response of mutation. Mostly because where I have more than enough products in cart with calculated fee and removing item while still maintaining minimal productCount the response still nulls fees array.
Desktop (please complete the following information): OS: Windows 11 Browser MS Edge Version 92 Plugin Versions WooGraphQL Version: 0.10.3 WPGraphQL Version: 1.6.3 WordPress Version: 5.8 WooCommerce Version: 5.5.2