|
|
@ -84,7 +84,7 @@ if ($site_env->site_mode == 'production' && $site_env->site_region == 'ae') { |
|
|
|
fbq('track', 'ViewContent', { |
|
|
|
fbq('track', 'ViewContent', { |
|
|
|
content_ids: ['<?php echo $product->get_id(); ?>'],
|
|
|
|
content_ids: ['<?php echo $product->get_id(); ?>'],
|
|
|
|
content_type: 'product', |
|
|
|
content_type: 'product', |
|
|
|
value: <?php echo $product->get_price(); ?>,
|
|
|
|
value: <?php echo round_price_with_tax($product->get_price()); ?>,
|
|
|
|
currency: '<?php echo get_woocommerce_currency(); ?>'
|
|
|
|
currency: '<?php echo get_woocommerce_currency(); ?>'
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -153,7 +153,7 @@ if ($site_env->site_mode == 'production' && $site_env->site_region == 'ae') { |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
document.addEventListener('DOMContentLoaded', function() { |
|
|
|
document.addEventListener('DOMContentLoaded', function() { |
|
|
|
fbq('track', 'AddPaymentInfo', { |
|
|
|
fbq('track', 'AddPaymentInfo', { |
|
|
|
value: <?php echo $cart_total; ?>,
|
|
|
|
value: <?php echo round_price_with_tax($cart_total); ?>,
|
|
|
|
currency: '<?php echo $currency; ?>'
|
|
|
|
currency: '<?php echo $currency; ?>'
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -162,7 +162,7 @@ if ($site_env->site_mode == 'production' && $site_env->site_region == 'ae') { |
|
|
|
'event': 'add_payment_info', |
|
|
|
'event': 'add_payment_info', |
|
|
|
'ecommerce': { |
|
|
|
'ecommerce': { |
|
|
|
'currency': '<?php echo $currency; ?>',
|
|
|
|
'currency': '<?php echo $currency; ?>',
|
|
|
|
'value': <?php echo $cart_total; ?> |
|
|
|
'value': <?php echo round_price_with_tax($cart_total); ?> |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -184,7 +184,7 @@ if ($site_env->site_mode == 'production' && $site_env->site_region == 'ae') { |
|
|
|
$items[] = [ |
|
|
|
$items[] = [ |
|
|
|
'item_id' => $product->get_id(), |
|
|
|
'item_id' => $product->get_id(), |
|
|
|
'item_name' => $product->get_name(), |
|
|
|
'item_name' => $product->get_name(), |
|
|
|
'price' => $product->get_price(), |
|
|
|
'price' => round_price_with_tax($product->get_price()), |
|
|
|
'quantity' => $item->get_quantity() |
|
|
|
'quantity' => $item->get_quantity() |
|
|
|
]; |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
@ -192,7 +192,7 @@ if ($site_env->site_mode == 'production' && $site_env->site_region == 'ae') { |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
document.addEventListener('DOMContentLoaded', function() { |
|
|
|
document.addEventListener('DOMContentLoaded', function() { |
|
|
|
fbq('track', 'Purchase', { |
|
|
|
fbq('track', 'Purchase', { |
|
|
|
value: <?php echo $order->get_total(); ?>,
|
|
|
|
value: <?php echo round_price_with_tax($order->get_total()); ?>,
|
|
|
|
currency: '<?php echo $order->get_currency(); ?>',
|
|
|
|
currency: '<?php echo $order->get_currency(); ?>',
|
|
|
|
content_ids: [<?php echo implode(',', array_column($items, 'item_id')); ?>],
|
|
|
|
content_ids: [<?php echo implode(',', array_column($items, 'item_id')); ?>],
|
|
|
|
content_type: 'product' |
|
|
|
content_type: 'product' |
|
|
@ -203,7 +203,7 @@ if ($site_env->site_mode == 'production' && $site_env->site_region == 'ae') { |
|
|
|
'event': 'purchase', |
|
|
|
'event': 'purchase', |
|
|
|
'ecommerce': { |
|
|
|
'ecommerce': { |
|
|
|
'currency': '<?php echo $order->get_currency(); ?>',
|
|
|
|
'currency': '<?php echo $order->get_currency(); ?>',
|
|
|
|
'value': <?php echo $order->get_total(); ?>,
|
|
|
|
'value': <?php echo round_price_with_tax($order->get_total()); ?>,
|
|
|
|
'items': <?php echo json_encode($items); ?> |
|
|
|
'items': <?php echo json_encode($items); ?> |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -228,7 +228,7 @@ if ($site_env->site_mode == 'production' && $site_env->site_region == 'ae') { |
|
|
|
$items[] = [ |
|
|
|
$items[] = [ |
|
|
|
'id' => $product->get_id(), |
|
|
|
'id' => $product->get_id(), |
|
|
|
'name' => $product->get_name(), |
|
|
|
'name' => $product->get_name(), |
|
|
|
'price' => $product->get_price(), |
|
|
|
'price' => round_price_with_tax($product->get_price()), |
|
|
|
'quantity' => $item->get_quantity() |
|
|
|
'quantity' => $item->get_quantity() |
|
|
|
]; |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
@ -317,7 +317,7 @@ add_action('wp_head', function() { |
|
|
|
$context['product'] = [ |
|
|
|
$context['product'] = [ |
|
|
|
'id' => $product->get_id(), |
|
|
|
'id' => $product->get_id(), |
|
|
|
'name' => $product->get_name(), |
|
|
|
'name' => $product->get_name(), |
|
|
|
'price' => floatval($product->get_price()), |
|
|
|
'price' => round_price_with_tax(floatval($product->get_price())), |
|
|
|
'sku' => $product->get_sku(), |
|
|
|
'sku' => $product->get_sku(), |
|
|
|
'category' => wp_get_post_terms($product->get_id(), 'product_cat', ['fields' => 'names'])[0] ?? '', |
|
|
|
'category' => wp_get_post_terms($product->get_id(), 'product_cat', ['fields' => 'names'])[0] ?? '', |
|
|
|
]; |
|
|
|
]; |
|
|
@ -327,7 +327,7 @@ add_action('wp_head', function() { |
|
|
|
// Страница чекаута - InitiateCheckout |
|
|
|
// Страница чекаута - InitiateCheckout |
|
|
|
$context['pixel_event_type'] = 'InitiateCheckout'; |
|
|
|
$context['pixel_event_type'] = 'InitiateCheckout'; |
|
|
|
if (WC()->cart && !WC()->cart->is_empty()) { |
|
|
|
if (WC()->cart && !WC()->cart->is_empty()) { |
|
|
|
$context['cart_total'] = floatval(WC()->cart->get_total('edit')); |
|
|
|
$context['cart_total'] = round_price_with_tax(floatval(WC()->cart->get_total('edit'))); |
|
|
|
$context['cart_items'] = []; |
|
|
|
$context['cart_items'] = []; |
|
|
|
$context['content_ids'] = []; |
|
|
|
$context['content_ids'] = []; |
|
|
|
|
|
|
|
|
|
|
@ -337,7 +337,7 @@ add_action('wp_head', function() { |
|
|
|
$item_data = [ |
|
|
|
$item_data = [ |
|
|
|
'item_id' => $product->get_id(), |
|
|
|
'item_id' => $product->get_id(), |
|
|
|
'item_name' => $product->get_name(), |
|
|
|
'item_name' => $product->get_name(), |
|
|
|
'price' => floatval($product->get_price()), |
|
|
|
'price' => round_price_with_tax(floatval($product->get_price())), |
|
|
|
'quantity' => intval($cart_item['quantity']), |
|
|
|
'quantity' => intval($cart_item['quantity']), |
|
|
|
'category' => wp_get_post_terms($product->get_id(), 'product_cat', ['fields' => 'names'])[0] ?? '', |
|
|
|
'category' => wp_get_post_terms($product->get_id(), 'product_cat', ['fields' => 'names'])[0] ?? '', |
|
|
|
]; |
|
|
|
]; |
|
|
@ -364,7 +364,7 @@ add_action('wp_head', function() { |
|
|
|
$order_items[] = [ |
|
|
|
$order_items[] = [ |
|
|
|
'item_id' => $product->get_id(), |
|
|
|
'item_id' => $product->get_id(), |
|
|
|
'item_name' => $product->get_name(), |
|
|
|
'item_name' => $product->get_name(), |
|
|
|
'price' => floatval($item->get_total() / $item->get_quantity()), |
|
|
|
'price' => round_price_with_tax(floatval($item->get_total() / $item->get_quantity())), |
|
|
|
'quantity' => intval($item->get_quantity()), |
|
|
|
'quantity' => intval($item->get_quantity()), |
|
|
|
'category' => wp_get_post_terms($product->get_id(), 'product_cat', ['fields' => 'names'])[0] ?? '', |
|
|
|
'category' => wp_get_post_terms($product->get_id(), 'product_cat', ['fields' => 'names'])[0] ?? '', |
|
|
|
]; |
|
|
|
]; |
|
|
@ -375,7 +375,7 @@ add_action('wp_head', function() { |
|
|
|
|
|
|
|
|
|
|
|
$context['order'] = [ |
|
|
|
$context['order'] = [ |
|
|
|
'id' => $order->get_id(), |
|
|
|
'id' => $order->get_id(), |
|
|
|
'total' => floatval($order->get_total()), |
|
|
|
'total' => round_price_with_tax(floatval($order->get_total())), |
|
|
|
'currency' => $order->get_currency(), |
|
|
|
'currency' => $order->get_currency(), |
|
|
|
'items' => $order_items, |
|
|
|
'items' => $order_items, |
|
|
|
'content_ids' => $content_ids, |
|
|
|
'content_ids' => $content_ids, |
|
|
|