| @@ -332,9 +332,24 @@ | ||
| 332 | 332 | * @param string $locale Receipt locale. |
| 333 | 333 | * @return array<int,array<string,mixed>> |
| 334 | 334 | */ |
| 335 | 335 | public static function with_store_tax_id_labels( array $tax_ids, string $locale = '' ): array { |
| 336 | - return Receipt_Sections::label_tax_ids( $tax_ids, 'store', $locale ); | |
| 336 | + $labels = Receipt_I18n_Labels::get_labels( $locale ); | |
| 337 | + | |
| 338 | + return array_map( | |
| 339 | + static function ( array $tax_id ) use ( $labels ): array { | |
| 340 | + if ( ! empty( $tax_id['label'] ) ) { | |
| 341 | + return $tax_id; | |
| 342 | + } | |
| 343 | + | |
| 344 | + $type = isset( $tax_id['type'] ) ? (string) $tax_id['type'] : 'other'; | |
| 345 | + $key = 'store_tax_id_label_' . $type; | |
| 346 | + $tax_id['label'] = $labels[ $key ] ?? $labels['store_tax_id_label_other']; | |
| 347 | + | |
| 348 | + return $tax_id; | |
| 349 | + }, | |
| 350 | + $tax_ids | |
| 351 | + ); | |
| 337 | 352 | } |
| 338 | 353 | |
| 339 | 354 | /** |
| 340 | 355 | * Resolve an optional free-text store field, treating a blank value as unset. |