@@ -94,7 +94,7 @@ function wc_graphql_get_order_statuses() {
9494 */
9595function wc_graphql_price ( $ price , $ args = array () ) {
9696 $ args = apply_filters (
97- 'wc_price_args ' ,
97+ 'wc_price_args ' , // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
9898 wp_parse_args (
9999 $ args ,
100100 array (
@@ -109,13 +109,32 @@ function wc_graphql_price( $price, $args = array() ) {
109109
110110 $ unformatted_price = $ price ;
111111 $ negative = $ price < 0 ;
112- $ price = apply_filters ( 'raw_woocommerce_price ' , floatval ( $ negative ? $ price * -1 : $ price ) );
113- $ price = apply_filters ( 'formatted_woocommerce_price ' , number_format ( $ price , $ args ['decimals ' ], $ args ['decimal_separator ' ], $ args ['thousand_separator ' ] ), $ price , $ args ['decimals ' ], $ args ['decimal_separator ' ], $ args ['thousand_separator ' ] );
114112
113+ // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
114+ $ price = apply_filters ( 'raw_woocommerce_price ' , floatval ( $ negative ? $ price * -1 : $ price ) );
115+
116+
117+ $ price = apply_filters (
118+ // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
119+ 'formatted_woocommerce_price ' ,
120+ number_format (
121+ $ price ,
122+ $ args ['decimals ' ],
123+ $ args ['decimal_separator ' ],
124+ $ args ['thousand_separator ' ]
125+ ),
126+ $ price ,
127+ $ args ['decimals ' ],
128+ $ args ['decimal_separator ' ],
129+ $ args ['thousand_separator ' ]
130+ );
131+
132+ // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
115133 if ( apply_filters ( 'woocommerce_price_trim_zeros ' , false ) && $ args ['decimals ' ] > 0 ) {
116134 $ price = wc_trim_zeros ( $ price );
117135 }
118136
137+ // phpcs:ignore PHPCompatibility.ParameterValues.NewHTMLEntitiesEncodingDefault.NotSet
119138 $ symbol = html_entity_decode ( get_woocommerce_currency_symbol ( $ args ['currency ' ] ) );
120139 $ return = ( $ negative ? '- ' : '' ) . sprintf ( $ args ['price_format ' ], $ symbol , $ price );
121140
@@ -127,7 +146,7 @@ function wc_graphql_price( $price, $args = array() ) {
127146 * @param array $args Pass on the args.
128147 * @param float $unformatted_price Price as float to allow plugins custom formatting. Since 3.2.0.
129148 */
130- return apply_filters ( 'wc_graphql_price ' , $ return , $ price , $ args , $ unformatted_price , $ symbol );
149+ return apply_filters ( 'graphql_woocommerce_price ' , $ return , $ price , $ args , $ unformatted_price , $ symbol );
131150}
132151
133152/**
@@ -142,9 +161,9 @@ function wc_graphql_price_range( $from, $to ) {
142161 /* translators: 1: price from 2: price to */
143162 _x ( '%1$s %2$s %3$s ' , 'Price range: from-to ' , 'wp-graphql-woocommerce ' ),
144163 is_numeric ( $ from ) ? wc_graphql_price ( $ from ) : $ from ,
145- apply_filters ( 'graphql_format_price_range_separator ' , '- ' , $ from , $ to ),
164+ apply_filters ( 'graphql_woocommerce_format_price_range_separator ' , '- ' , $ from , $ to ),
146165 is_numeric ( $ to ) ? wc_graphql_price ( $ to ) : $ to
147166 );
148167
149- return apply_filters ( 'graphql_format_price_range ' , $ price , $ from , $ to );
168+ return apply_filters ( 'graphql_woocommerce_format_price_range ' , $ price , $ from , $ to );
150169}
0 commit comments