diff --git a/integration/woocommerce.php b/integration/woocommerce.php index a6cefef0..3bf496da 100755 --- a/integration/woocommerce.php +++ b/integration/woocommerce.php @@ -90,6 +90,10 @@ function gtm4wp_woocommerce_process_product( $product, $additional_product_attri 'google_business_vertical' => $gtm4wp_options[ GTM4WP_OPTION_INTEGRATE_WCBUSINESSVERTICAL ], ); + if ( 'variation' === $product_type ) { + $_temp_productdata['item_group_id'] = $parent_product_id; + } + if ( 1 === count( $product_cat_parts ) ) { $_temp_productdata['item_category'] = $product_cat_parts[0]; } elseif ( count( $product_cat_parts ) > 1 ) { diff --git a/js/gtm4wp-woocommerce.js b/js/gtm4wp-woocommerce.js index a3f24369..306bf752 100644 --- a/js/gtm4wp-woocommerce.js +++ b/js/gtm4wp-woocommerce.js @@ -513,6 +513,7 @@ function gtm4wp_woocommerce_process_pages() { current_product_detail_data.price = gtm4wp_make_sure_is_float( current_product_detail_data.price ); + current_product_detail_data.item_group_id = current_product_detail_data.id; current_product_detail_data.id = product_variation.variation_id; current_product_detail_data.item_id = product_variation.variation_id; current_product_detail_data.sku = product_variation.sku; @@ -529,6 +530,8 @@ function gtm4wp_woocommerce_process_pages() { current_product_detail_data.variant = product_variation_attribute_values.join(','); gtm4wp_last_selected_product_variation = current_product_detail_data; + delete current_product_detail_data.internal_id; + // fire ga4 version gtm4wp_push_ecommerce( 'view_item', [ current_product_detail_data ], { 'currency': gtm4wp_currency,