diff --git a/templates_user/shop-basket/basket.php b/templates_user/shop-basket/basket.php
index 175bfa2..e0014cb 100644
--- a/templates_user/shop-basket/basket.php
+++ b/templates_user/shop-basket/basket.php
@@ -33,6 +33,35 @@
endif; ?>
+ if ( $this -> settings['google_tag_manager_id'] && is_array( $this -> basket ) && count( $this -> basket ) ):?>
+
+ endif;?>
\ No newline at end of file
diff --git a/templates_user/shop-order/order-details.php b/templates_user/shop-order/order-details.php
index 93c0c6f..09fed35 100644
--- a/templates_user/shop-order/order-details.php
+++ b/templates_user/shop-order/order-details.php
@@ -170,25 +170,27 @@
currency: "PLN",
value: = \Shared\Helpers\Helpers::normalize_decimal( round( $this -> order['summary'], 2 ) ) - str_replace( ',', '.', round( $this -> order['transport_cost'], 2 ) );?>,
shipping: = \Shared\Helpers\Helpers::normalize_decimal( $this -> order['transport_cost'] );?>,
- user_email: "= $this -> order['client_email'] ?>",
- user_phone: "= $this -> order['client_phone'] ?>",
- user_name: "= $this -> order['client_name'] ?>",
- user_surname: "= $this -> order['client_surname'] ?>",
- user_street: "= $this -> order['client_street'] ?>",
- user_city: "= $this -> order['client_city'] ?>",
- user_country: "Polska",
- user_postal_code: "= $this -> order['client_postal_code'] ?>",
items: [
foreach ( $this -> order['products'] as $product ):?>
{
- id: = (int)$product['product_id'];?>,
- name: '= $product['name'];?>',
- quantity: = $product['quantity'];?>,
- price: = $product['price_brutto_promo'];?>,
+ item_id: "= $product['product_id'];?>",
+ item_name: '= $product['name'];?>',
+ quantity: = (int)$product['quantity'];?>,
+ price: = (float)$product['price_brutto_promo'] > 0 ? \Shared\Helpers\Helpers::normalize_decimal( $product['price_brutto_promo'] ) : \Shared\Helpers\Helpers::normalize_decimal( $product['price_brutto'] );?>,
google_business_vertical: 'retail'
} if ( $product != end( $this -> order['products'] ) ) echo ',';?>
endforeach;?>
]
+ },
+ user_data: {
+ email: "= $this -> order['client_email'] ?>",
+ phone_number: "= $this -> order['client_phone'] ?>",
+ first_name: "= $this -> order['client_name'] ?>",
+ last_name: "= $this -> order['client_surname'] ?>",
+ street: "= $this -> order['client_street'] ?>",
+ city: "= $this -> order['client_city'] ?>",
+ country: "PL",
+ postal_code: "= $this -> order['client_postal_code'] ?>"
}
});
endif;?>
diff --git a/templates_user/shop-product/product.php b/templates_user/shop-product/product.php
index d337cf2..0ecc00b 100644
--- a/templates_user/shop-product/product.php
+++ b/templates_user/shop-product/product.php
@@ -247,16 +247,17 @@
dataLayer.push({
event: "view_item",
ecommerce: {
+ currency: "PLN",
+ value: if ( $this -> product['price_brutto_promo'] ): echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto_promo'] ); else: echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto'] ); endif;?>,
items: [
{
item_id: "= $this -> product['id'];?>",
item_name: "= str_replace( '"', '', $this -> product['language']['name'] );?>",
- price: ' if ( $this -> product['price_brutto_promo'] ): echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto_promo'] ); else: echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto'] ); endif;?>',
+ price: if ( $this -> product['price_brutto_promo'] ): echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto_promo'] ); else: echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto'] ); endif;?>,
quantity: 1,
google_business_vertical: "retail"
}
- ],
- value: if ( $this -> product['price_brutto_promo'] ): echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto_promo'] ); else: echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto'] ); endif;?>
+ ]
}
});
endif;?>
@@ -573,7 +574,7 @@
item_id: "= $this -> product['id'];?>",
item_name: "= str_replace( '"', '', $this -> product['language']['name'] );?>",
price: if ( $this -> product['price_brutto_promo'] ): echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto_promo'] ); else: echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto'] ); endif;?>,
- quantity: quantity,
+ quantity: parseInt(quantity),
google_business_vertical: "retail"
}
]