<script type="text/javascript">
    window.dataLayer = window.dataLayer || [];  // Clear the previous ecommerce object.
    window.dataLayer.push({
    event: "view_item",
    ecommerce: {
        currency: "BDT",
        value: <?php echo e($layerPrice); ?>,
        items: [
        {
            item_id: "<?php echo e($product->sku ?? $product->id); ?>",
            item_name: "<?php echo e($product->title); ?>",
            affiliation: "<?php echo e(config('app.name')); ?>",
            coupon: "",
            discount: <?php echo e($layerDiscount ? $layerDiscount : 0); ?>,
            index: 0,
            item_brand: "<?php echo e($product->brand->name ?? ''); ?>",
            item_category : "<?php echo e($product->categories[0]->name ?? ''); ?>", // First Category
            item_category2: "<?php echo e($product->categories[1]->name ?? ''); ?>", // Second Category (optional)
            item_category3: "<?php echo e($product->categories[2]->name ?? ''); ?>", // Third Category (optional)
            item_category4: "<?php echo e($product->categories[3]->name ?? ''); ?>", // Fourth Category (optional)
            item_list_id: "",
            item_list_name: "",
            item_variant: "<?php echo e($product->colors->first()->name ?? ''); ?>",
            location_id: "",
            price: <?php echo e($layerPrice); ?>,
            quantity: 1
        }
        ]
    }
    });
</script><?php /**PATH /home/apleusbj/public_html/resources/views/layouts/frontend/partials/gtm_view_item_event_data_layer.blade.php ENDPATH**/ ?>