@@ -91,34 +91,152 @@ public static function register() {
9191 'discountTotal ' => array (
9292 'type ' => 'String ' ,
9393 'description ' => __ ( 'Discount total amount ' , 'wp-graphql-woocommerce ' ),
94+ 'args ' => array (
95+ 'format ' => array (
96+ 'type ' => 'PricingFieldFormatEnum ' ,
97+ 'description ' => __ ( 'Format of the price ' , 'wp-graphql-woocommerce ' ),
98+ ),
99+ ),
100+ 'resolve ' => function ( $ source , $ args ) {
101+ if ( isset ( $ args ['format ' ] ) && 'raw ' === $ args ['format ' ] ) {
102+ // @codingStandardsIgnoreLine.
103+ return $ source ->discountTotalRaw ;
104+ } else {
105+ // @codingStandardsIgnoreLine.
106+ return $ source ->discountTotal ;
107+ }
108+ },
94109 ),
95110 'discountTax ' => array (
96- 'type ' => 'Float ' ,
111+ 'type ' => 'String ' ,
97112 'description ' => __ ( 'Discount tax amount ' , 'wp-graphql-woocommerce ' ),
113+ 'args ' => array (
114+ 'format ' => array (
115+ 'type ' => 'PricingFieldFormatEnum ' ,
116+ 'description ' => __ ( 'Format of the price ' , 'wp-graphql-woocommerce ' ),
117+ ),
118+ ),
119+ 'resolve ' => function ( $ source , $ args ) {
120+ if ( isset ( $ args ['format ' ] ) && 'raw ' === $ args ['format ' ] ) {
121+ // @codingStandardsIgnoreLine.
122+ return $ source ->discountTaxRaw ;
123+ } else {
124+ // @codingStandardsIgnoreLine.
125+ return $ source ->discountTax ;
126+ }
127+ },
98128 ),
99129 'shippingTotal ' => array (
100130 'type ' => 'String ' ,
101131 'description ' => __ ( 'Shipping total amount ' , 'wp-graphql-woocommerce ' ),
132+ 'args ' => array (
133+ 'format ' => array (
134+ 'type ' => 'PricingFieldFormatEnum ' ,
135+ 'description ' => __ ( 'Format of the price ' , 'wp-graphql-woocommerce ' ),
136+ ),
137+ ),
138+ 'resolve ' => function ( $ source , $ args ) {
139+ if ( isset ( $ args ['format ' ] ) && 'raw ' === $ args ['format ' ] ) {
140+ // @codingStandardsIgnoreLine.
141+ return $ source ->shippingTotalRaw ;
142+ } else {
143+ // @codingStandardsIgnoreLine.
144+ return $ source ->shippingTotal ;
145+ }
146+ },
102147 ),
103148 'shippingTax ' => array (
104- 'type ' => 'Float ' ,
149+ 'type ' => 'String ' ,
105150 'description ' => __ ( 'Shipping tax amount ' , 'wp-graphql-woocommerce ' ),
151+ 'args ' => array (
152+ 'format ' => array (
153+ 'type ' => 'PricingFieldFormatEnum ' ,
154+ 'description ' => __ ( 'Format of the price ' , 'wp-graphql-woocommerce ' ),
155+ ),
156+ ),
157+ 'resolve ' => function ( $ source , $ args ) {
158+ if ( isset ( $ args ['format ' ] ) && 'raw ' === $ args ['format ' ] ) {
159+ // @codingStandardsIgnoreLine.
160+ return $ source ->shippingTaxRaw ;
161+ } else {
162+ // @codingStandardsIgnoreLine.
163+ return $ source ->shippingTax ;
164+ }
165+ },
106166 ),
107167 'cartTax ' => array (
108- 'type ' => 'Float ' ,
168+ 'type ' => 'String ' ,
109169 'description ' => __ ( 'Cart tax amount ' , 'wp-graphql-woocommerce ' ),
170+ 'args ' => array (
171+ 'format ' => array (
172+ 'type ' => 'PricingFieldFormatEnum ' ,
173+ 'description ' => __ ( 'Format of the price ' , 'wp-graphql-woocommerce ' ),
174+ ),
175+ ),
176+ 'resolve ' => function ( $ source , $ args ) {
177+ if ( isset ( $ args ['format ' ] ) && 'raw ' === $ args ['format ' ] ) {
178+ // @codingStandardsIgnoreLine.
179+ return $ source ->cartTaxRaw ;
180+ } else {
181+ // @codingStandardsIgnoreLine.
182+ return $ source ->cartTax ;
183+ }
184+ },
110185 ),
111186 'total ' => array (
112187 'type ' => 'String ' ,
113188 'description ' => __ ( 'Order grand total ' , 'wp-graphql-woocommerce ' ),
189+ 'args ' => array (
190+ 'format ' => array (
191+ 'type ' => 'PricingFieldFormatEnum ' ,
192+ 'description ' => __ ( 'Format of the price ' , 'wp-graphql-woocommerce ' ),
193+ ),
194+ ),
195+ 'resolve ' => function ( $ source , $ args ) {
196+ if ( isset ( $ args ['format ' ] ) && 'raw ' === $ args ['format ' ] ) {
197+ // @codingStandardsIgnoreLine.
198+ return $ source ->totalRaw ;
199+ } else {
200+ return $ source ->total ;
201+ }
202+ },
114203 ),
115204 'totalTax ' => array (
116- 'type ' => 'Float ' ,
205+ 'type ' => 'String ' ,
117206 'description ' => __ ( 'Order taxes ' , 'wp-graphql-woocommerce ' ),
207+ 'args ' => array (
208+ 'format ' => array (
209+ 'type ' => 'PricingFieldFormatEnum ' ,
210+ 'description ' => __ ( 'Format of the price ' , 'wp-graphql-woocommerce ' ),
211+ ),
212+ ),
213+ 'resolve ' => function ( $ source , $ args ) {
214+ if ( isset ( $ args ['format ' ] ) && 'raw ' === $ args ['format ' ] ) {
215+ // @codingStandardsIgnoreLine.
216+ return $ source ->totalTaxRaw ;
217+ } else {
218+ // @codingStandardsIgnoreLine.
219+ return $ source ->totalTax ;
220+ }
221+ },
118222 ),
119223 'subtotal ' => array (
120224 'type ' => 'String ' ,
121225 'description ' => __ ( 'Order subtotal ' , 'wp-graphql-woocommerce ' ),
226+ 'args ' => array (
227+ 'format ' => array (
228+ 'type ' => 'PricingFieldFormatEnum ' ,
229+ 'description ' => __ ( 'Format of the price ' , 'wp-graphql-woocommerce ' ),
230+ ),
231+ ),
232+ 'resolve ' => function ( $ source , $ args ) {
233+ if ( isset ( $ args ['format ' ] ) && 'raw ' === $ args ['format ' ] ) {
234+ // @codingStandardsIgnoreLine.
235+ return $ source ->subtotalRaw ;
236+ } else {
237+ return $ source ->subtotal ;
238+ }
239+ },
122240 ),
123241 'orderNumber ' => array (
124242 'type ' => 'String ' ,
0 commit comments