Skip to content

Commit

Permalink
Include state in the customer data
Browse files Browse the repository at this point in the history
  • Loading branch information
TorbenLundsgaard committed Nov 8, 2023
1 parent cecd6be commit 773f48e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ Enhancements:
* Added the filter 'gtmkit_datalayer_script', which allows you to filter the datalayer script.

Bugfixes:
* Billing state and shipping stat was not included in the customer data on the 'purchase' event.

Other:
* Tested up to WordPress 6.4
Expand Down
2 changes: 2 additions & 0 deletions src/Integration/WooCommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,7 @@ public function include_customer_data( array $data_layer, $order_value ): array
$data_layer['ecommerce']['customer']['billing_city'] = $wc_customer->get_billing_city();
$data_layer['ecommerce']['customer']['billing_postcode'] = $wc_customer->get_billing_postcode();
$data_layer['ecommerce']['customer']['billing_country'] = $wc_customer->get_billing_country();
$data_layer['ecommerce']['customer']['billing_state'] = $wc_customer->get_billing_state();
$data_layer['ecommerce']['customer']['billing_email'] = $wc_customer->get_billing_email();
$data_layer['ecommerce']['customer']['billing_email_hash'] = ( $wc_customer->get_billing_email() ) ? hash( 'sha256', $wc_customer->get_billing_email() ) : '';
$data_layer['ecommerce']['customer']['billing_phone'] = $wc_customer->get_billing_phone();
Expand All @@ -1171,6 +1172,7 @@ public function include_customer_data( array $data_layer, $order_value ): array
$data_layer['ecommerce']['customer']['shipping_city'] = $wc_customer->get_shipping_city();
$data_layer['ecommerce']['customer']['shipping_postcode'] = $wc_customer->get_shipping_postcode();
$data_layer['ecommerce']['customer']['shipping_country'] = $wc_customer->get_shipping_country();
$data_layer['ecommerce']['customer']['shipping_state'] = $wc_customer->get_shipping_state();

return $data_layer;
}
Expand Down

0 comments on commit 773f48e

Please sign in to comment.