You are here

static function CommerceGoogleTagManagerHelper::getWrappedLineItem in Commerce Google Tag Manager 7.2

Wraps the give line-item, if needed, to a EntityMetadataWrapper object.

Parameters

array|stdClass $item The LineItem object or array:

Return value

\EntityMetadataWrapper

2 calls to CommerceGoogleTagManagerHelper::getWrappedLineItem()
CommerceGoogleTagManagerActionAddToCart::execute in includes/rules/CommerceGoogleTagManagerActionAddToCart.php
Executes the action.
CommerceGoogleTagManagerActionRemoveFromCart::execute in includes/rules/CommerceGoogleTagManagerActionRemoveFromCart.php
Executes the action.

File

includes/CommerceGoogleTagManagerHelper.php, line 29
This file contains the helper class CommerceGoogleTagManagerHelper.

Class

CommerceGoogleTagManagerHelper
@file This file contains the helper class CommerceGoogleTagManagerHelper.

Code

static function getWrappedLineItem($item) {
  if (!$item instanceof EntityMetadataWrapper) {
    return entity_metadata_wrapper('commerce_line_item', $item);
  }
  return $item;
}