yireo-magento1 / Yireo_GoogleTagManager

Implement Google Tag Manager in Magento 1 (deprecated)
Open Software License 3.0
56 stars 46 forks source link

Inconsistent Price & Tax Values #104

Open Lex50 opened 5 years ago

Lex50 commented 5 years ago

Hi,

Depending on whether Configuration > Sales > Tax > Calculation Settings > Catalog Prices is set to Including Tax or Excluding Tax, this affects the tax, and prices (Ex tax & Inc tax), calculated in base/default/template/googletagmanager/data/product.phtml

When Configuration > Sales > Tax > Price Display Settings > Display Product Prices In Catalog set to Including and Excluding Tax, and

When Configuration > Sales > Tax > Calculation Settings > Catalog Prices set to Including Tax

Then the product page displays Excl. Tax: £83.33 and Incl. Tax: £100.00, and the dataLayer is as follows:

dataLayer
[{
    "productPrice": "116.67", (Incorrect value based on £100 Incl. Tax price)
    "productPriceExcludingTax": "100.00", (Incorrect value based on £100 Incl. Tax price)
    "productTax": "16.67", (Correct value based on £100 Incl. Tax price)
    "productTaxRate": 20
},
{
    "ecommerce":     {
        "detail":       {
            "products": [{
                "price": "100.00", (Correct value based on £100 Incl. Tax price)
                "priceexcludingtax": "83.33", (Correct value based on £100 Incl. Tax price)
                "tax": "16.67", (Correct value based on £100 Incl. Tax price)
                "taxrate": 20,
            }]
        }
    }
}]

Note the "productPrice" and "price" do not match, and "productPriceExcludingTax" and "priceexcludingtax" do not match.

When Configuration > Sales > Tax > Calculation Settings > Catalog Prices set to Excluding Tax

Then the product page displays Excl. Tax: £100.00 and Incl. Tax: £120.00, and the dataLayer is as follows:

dataLayer
[{
    "productPrice": "116.67", (Incorrect value £100 Excl. Tax price)
    "productPriceExcludingTax": "100.00", (Correct value £100 Excl. Tax price)
    "productTax": "16.67", (Incorrect value £100 Excl. Tax price)
    "productTaxRate": 20,
},
{
    "ecommerce":     {
        "detail":       {
            "products": [{
                "price": "100.00", (Incorrect value £100 Excl. Tax price)
                "priceexcludingtax": "83.33", (Incorrect value £100 Excl. Tax price)
                "tax": "16.67", (Incorrect value £100 Excl. Tax price)
                "taxrate": 20,
            }]
        }
    }
}]

Tested on fresh install with sample data of Magento 1.9.4.1 and Yireo_GoogleTagManager 1.5.4

Thanks

jissereitsma commented 5 years ago

Could you check if this is still an issue with the latest release 1.6.0? https://github.com/yireo/Yireo_GoogleTagManager/releases

Lex50 commented 5 years ago

Hi Jisse,

Everything looks good, except prices for child products - they are identical.

e.g.

dataLayer = [({
"customerGroupId":"1",
"customerGroupCode":"GENERAL",
"productId":"404",
"productName":"Plaid Cotton Shirt",
"productSku":"msj006c",
"productPrice":"173.20",
"productPriceExcludingTax":"160.00",
"productTax":"13.20",
"productTaxRate":8.25,
"productGender":"Male",
"productChildren":[

    {"name":"Plaid Cotton Shirt",
    "id":"237",
    "price":"160.00",
    "priceexcludingtax":"160.00",
    "sku":"msj006"},

    {"name":"Plaid Cotton Shirt",
    "id":"238",
    "price":"160.00",
    "priceexcludingtax":"160.00",
    "sku":"msj007"},

    {"name":"Plaid Cotton Shirt",
    "id":"239",
    "price":"160.00",
    "priceexcludingtax":"160.00",
    "sku":"msj008"},

    {"name":"Plaid Cotton Shirt",
    "id":"503",
    "price":"160.00",
    "priceexcludingtax":"160.00",
    "sku":"msj006xs"},

Tested on fresh install with sample data of Magento 1.9.4.1 and Yireo_GoogleTagManager 1.6.0

jissereitsma commented 5 years ago

Could you see if 1.6.1 fixes this for you?

Lex50 commented 5 years ago

Yeah! 1.6.1 fixes it :)