CVM / Magento_GoogleTagManager

Google Tag Manager extension for Magento
67 stars 55 forks source link

Only output transactionShippingMethod for non-virtual Orders #29

Open wpalmer opened 8 years ago

wpalmer commented 8 years ago

transactionShippingMethod was unconditionally attempting to output the shipping "Carrier Code". This is fine in most cases, but for "virtual" orders, no CarrierCode is defined, resulting in an illegal offset error (internal to Magento) when the non-existent carrier information is requested.

To avoid this, add a ->getIsVirtual() check on the $order, and only request Shipping Carrier information for non-Virtual orders. This is the same logic (though not exactly the same method) used within core Magento code within the Checkout process, and so appears to be an expected condition for accessing such data.