Skip to content

Commit

Permalink
Merge pull request #380 from woocommerce/fix/format-price
Browse files Browse the repository at this point in the history
  • Loading branch information
tomalec authored Mar 10, 2024
2 parents a8f5281 + 03bb117 commit 01a2377
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions assets/js/src/tracker/data-formatting.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,11 @@ export const purchase = ( { order } ) => {
}

return {
currency: order.currency,
value: parseInt( order.value ),
currency: order.totals.currency_code,
value: formatPrice(
order.totals.total_price,
order.totals.currency_minor_unit
),
items: order.items.map( getProductFieldObject ),
};
};
Expand Down
9 changes: 6 additions & 3 deletions includes/class-wc-abstract-google-analytics-js.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,12 @@ public function get_formatted_order( $order ): array {
}

return array(
'currency' => $order->get_currency(),
'value' => $this->get_formatted_price( $order->get_total() ),
'items' => array_map(
'totals' => array(
'currency_code' => $order->get_currency(),
'total_price' => $this->get_formatted_price( $order->get_total() ),
'currency_minor_unit' => wc_get_price_decimals(),
),
'items' => array_map(
function ( $item ) {
return array_merge(
$this->get_formatted_product( $item->get_product() ),
Expand Down

0 comments on commit 01a2377

Please sign in to comment.