Automattic\WooCommerce\Internal\Admin\Reports
HposLegacyOrderReportQueryBuilder::format_money_column
Wrap a mapped money column so bare SELECTs match the legacy meta format.
HPOS money columns are DECIMAL(26,8), so selecting one raw yields e.g. '50.00000000' where the CPT meta stores '50.00'. Rounding to the store's price decimals restores the legacy format. Never applied inside aggregate functions: several money metas are stored at full precision, so per-row rounding would drift from the CPT sums.
Method of the class: HposLegacyOrderReportQueryBuilder{}
No Hooks.
Returns
string. SQL expression.
Usage
// private - for code of main (parent) class only $result = $this->format_money_column( $column ): string;
- $column(string) (required)
- Qualified column reference.
HposLegacyOrderReportQueryBuilder::format_money_column() HposLegacyOrderReportQueryBuilder::format money column code WC 11.1.2
private function format_money_column( string $column ): string {
return "ROUND({$column}, " . wc_get_price_decimals() . ')';
}