You are here

function hook_commerce_google_tag_manager_order_data_alter in Commerce Google Tag Manager 7.2

Allow other modules to alter the Order data of a order line-item.

The $context variable is an associative array with the following keys:

  • order : the Order being processed
  • event : the event that is requesting the product data
1 invocation of hook_commerce_google_tag_manager_order_data_alter()
CommerceGoogleTagManagerHelper::getOrderData in includes/CommerceGoogleTagManagerHelper.php
Gets an array-based representation of the given Order.

File

./commerce_google_tag_manager.api.php, line 30
Documentation of Commerce GoogleTagManager hooks.

Code

function hook_commerce_google_tag_manager_order_data_alter(&$order_data, $context) {

  // If we're sending the Purchase event
  if ($context['event'] == 'purchase') {

    // Remove the Sipping costs
    unset($order_data['shipping']);
  }
}