Product price being reported as tax exclusive in purchase event
-
Hi there,
First – thank you so much for a fantastic plugin! ??
In Australia, product prices are tax-inclusive – so I’m trying to make sure that Google Analytics reporting reflects that. In the GTM4WP settings, I found the option to control whether purchase revenue includes tax and shipping – however the actual products in the
ecommerce.purchase.products
array are always tax-exclusive, no matter what revenue options are selected.I went hunting through the code and found the line that controls this – line 193 in woocommerce.php:
$product_price = (float) $order->get_item_total( $item );
I updated that line to the following:
$product_price = (float) $order->get_item_total( $item ) + $order->get_item_tax( $item );
..and now the product array includes tax in each item’s price (and thus reports as expected in Google Analytics Product Performance). This might have done what I want, and it seems to work in my testing – but I have no idea whether this is actually the correct fix for this.
Could I recommend that there is a checkbox in a future version to control whether the purchase product array reports the price as tax inclusive or not? Or perhaps you can read it from the WooCommerce tax settings?
- The topic ‘Product price being reported as tax exclusive in purchase event’ is closed to new replies.