Automattic\WooCommerce\Internal\RestApi\Routes\V4\Refunds

DataUtils::convert_proportional_taxes_to_schema_formatprivateWC 1.0

Convert calculated taxes (internal format) to schema format.

Метод класса: DataUtils{}

Хуков нет.

Возвращает

Массив. Schema format with id and refund_total keys.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->convert_proportional_taxes_to_schema_format( $calculated_taxes ): array;
$calculated_taxes(массив) (обязательный)
Taxes keyed by tax ID with amounts.

Код DataUtils::convert_proportional_taxes_to_schema_format() WC 10.5.2

private function convert_proportional_taxes_to_schema_format( array $calculated_taxes ): array {
	$result = array();
	foreach ( $calculated_taxes as $tax_id => $amount ) {
		$result[] = array(
			'id'           => (int) $tax_id,
			'refund_total' => $amount,
		);
	}
	return $result;
}