decimal_qty_enabled() ) { return $endpoints; } foreach ( $endpoints as $route => $handlers ) { if ( ! \is_array( $handlers ) ) { continue; } $is_orders = 1 === preg_match( '#^/wc/v3/orders(?:/\(\?P[^/]+\))?$#', $route ); $is_products = 0 === strpos( $route, '/wc/v3/products' ); if ( ! $is_orders && ! $is_products ) { continue; } foreach ( $handlers as $key => $handler ) { // Route-level option keys (e.g. 'namespace') are not handler arrays. if ( ! \is_array( $handler ) || ! isset( $handler['args'] ) || ! \is_array( $handler['args'] ) ) { continue; } if ( $is_orders && 'integer' === ( $handler['args']['line_items']['items']['properties']['quantity']['type'] ?? null ) ) { $endpoints[ $route ][ $key ]['args']['line_items']['items']['properties']['quantity']['type'] = 'number'; } if ( $is_products && 'integer' === ( $handler['args']['stock_quantity']['type'] ?? null ) ) { $endpoints[ $route ][ $key ]['args']['stock_quantity']['type'] = 'number'; } } } return $endpoints; } }