= $this->basket_details; ?>
diff --git a/templates/shop-basket/summary-view.php b/templates/shop-basket/summary-view.php
index 78acbe5..26e373d 100644
--- a/templates/shop-basket/summary-view.php
+++ b/templates/shop-basket/summary-view.php
@@ -73,10 +73,11 @@
$begin_checkout_items .= ',';
$begin_checkout_items .= '{';
- $begin_checkout_items .= '"id": "' . $product['id'] . '",';
- $begin_checkout_items .= '"name": "' . $product['language']['name'] . '",';
+ $begin_checkout_items .= '"item_id": "' . $product['id'] . '",';
+ $begin_checkout_items .= '"item_name": "' . str_replace( '"', '', $product['language']['name'] ) . '",';
$begin_checkout_items .= '"price": ' . \Shared\Helpers\Helpers::normalize_decimal( $price_product['price_new'] ) . ',';
- $begin_checkout_items .= '"quantity": ' . $position['quantity'];
+ $begin_checkout_items .= '"quantity": ' . (int)$position['quantity'] . ',';
+ $begin_checkout_items .= '"google_business_vertical": "retail"';
$begin_checkout_items .= '}';
?>
endforeach;?>
diff --git a/templates/shop-order/order-details.php b/templates/shop-order/order-details.php
index d32eef6..fb09f05 100644
--- a/templates/shop-order/order-details.php
+++ b/templates/shop-order/order-details.php
@@ -169,17 +169,17 @@
event: "purchase",
ecommerce: {
transaction_id: "= $this -> order['id'];?>",
- value: 25.42,
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'] );?>,
items: [
foreach ( $this -> order['products'] as $product ):?>
{
- 'id': = (int)$product['product_id'];?>,
- 'name': '= $product['name'];?>',
- 'quantity': = $product['quantity'];?>,
- 'price': = ((float)$product['price_brutto_promo'] > 0 && (float)$product['price_brutto_promo'] < (float)$product['price_brutto']) ? (float)$product['price_brutto_promo'] : (float)$product['price_brutto'];?>
+ item_id: "= $product['product_id'];?>",
+ item_name: "= str_replace( '"', '', $product['name'] );?>",
+ quantity: = (int)$product['quantity'];?>,
+ price: = ((float)$product['price_brutto_promo'] > 0 && (float)$product['price_brutto_promo'] < (float)$product['price_brutto']) ? \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;?>
]
diff --git a/templates/shop-product/product.php b/templates/shop-product/product.php
index 3d0ce7c..7cb7468 100644
--- a/templates/shop-product/product.php
+++ b/templates/shop-product/product.php
@@ -275,12 +275,15 @@
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;?>',
- quantity: 1
+ 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"
}
]
}
@@ -617,7 +620,8 @@
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"
}
]
}