Skip to content

Commit

Permalink
Fix: no internal_id in cartContent and wrong script block output
Browse files Browse the repository at this point in the history
  • Loading branch information
duracelltomi committed Jan 11, 2024
1 parent 91524d0 commit 00c827f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
2 changes: 2 additions & 0 deletions integration/woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,8 @@ function gtm4wp_woocommerce_datalayer_filter_items( $data_layer ) {
'cart'
);

unset( $eec_product_array['internal_id'] );

$data_layer['cartContent']['items'][] = $eec_product_array;
}
}
Expand Down
11 changes: 0 additions & 11 deletions public/frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -1222,11 +1222,6 @@ function gtm4wp_fire_additional_datalayer_pushes() {
$has_html5_support = current_theme_supports( 'html5' );
$add_cookiebot_ignore = (bool) $gtm4wp_options[ GTM4WP_OPTION_INTEGRATE_COOKIEBOT ];

if ( count( $gtm4wp_additional_datalayer_pushes ) > 0 ) {
echo '
<script' . ( $has_html5_support ? '' : ' type="text/javascript"' ) . ( $add_cookiebot_ignore ? ' data-cookieconsent="ignore"' : '' ) . '>';
}

foreach ( $gtm4wp_additional_datalayer_pushes as $one_event ) {
$datalayer_push_code = '';

Expand All @@ -1248,12 +1243,6 @@ function gtm4wp_fire_additional_datalayer_pushes() {

// Reset array so that additional data can be added and this function can be re-run without double running code.
$gtm4wp_additional_datalayer_pushes = array();

if ( count( $gtm4wp_additional_datalayer_pushes ) > 0 ) {
echo '
</script>';
}

}

/**
Expand Down

0 comments on commit 00c827f

Please sign in to comment.