wp-graphql-woocommerce
wp-graphql-woocommerce copied to clipboard
How to get availableShippingMethods include tax when taxable setting is on
I want to show correct price for shipping options but availableShippingMethods in Cart always show price with with no tax include
{ cart { displayPricesIncludeTax availableShippingMethods { rates { id instanceId label methodId cost } } } }
How to make price include tax when taxable option is enable in setting or can we get Tax status field from setting
@oat-tigerheart now encountering this issue as well.
For now manually extending the ShippingRate graphql object to access the get_shipping_tax function e.g.
add_action( 'graphql_register_types', function() { register_graphql_fields( 'ShippingRate', array( 'tax' => array( 'type' => 'Float', 'description' => __( 'Shipping rate tax amount', 'wp-graphql-woocommerce' ), 'resolve' => static function ( $source ) { return ! empty( $source->get_shipping_tax() ) ? $source->get_shipping_tax() : 0; }, ) )); });