wp-graphql-woocommerce icon indicating copy to clipboard operation
wp-graphql-woocommerce copied to clipboard

How to get availableShippingMethods include tax when taxable setting is on

Open oat-tigerheart opened this issue 1 year ago • 1 comments

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 avatar Sep 15 '23 08:09 oat-tigerheart

@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; }, ) )); });

MonPetitUd avatar May 22 '24 03:05 MonPetitUd