Skip to content

Commit

Permalink
Merge pull request #353 from Dekadinious/patch-2
Browse files Browse the repository at this point in the history
Fix deprecated warning and update function comment
  • Loading branch information
duracelltomi authored Nov 18, 2024
2 parents 480f20f + 6770468 commit e162625
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions integration/woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ function gtm4wp_woocommerce_add_global_vars( $return ) {
*
* @see https://developers.google.com/analytics/devguides/collection/ua/gtm/enhanced-ecommerce
*
* @param WP_Product $product An instance of WP_Product that needs to be transformed into an enhanced ecommerce product object.
* @param array $additional_product_attributes Any key-value pair that needs to be added into the enhanced ecommerce product object.
* @param string $attributes_used_for The placement ID of the product that is passed to the apply_filters hook so that 3rd party code can be notified where this product data is being used.
* @return array The enhanced ecommerce product object of the WooCommerce product.
* @param WP_Product $product An instance of WP_Product that needs to be transformed into an enhanced ecommerce product object.
* @param array $additional_product_attributes Any key-value pair that needs to be added into the enhanced ecommerce product object.
* @param string $attributes_used_for The placement ID of the product that is passed to the apply_filters hook so that 3rd party code can be notified where this product data is being used.
* @return array|false The enhanced ecommerce product object of the WooCommerce product, or false if the product does not exist.
*/
function gtm4wp_woocommerce_process_product( $product, $additional_product_attributes, $attributes_used_for ) {
global $gtm4wp_options;
Expand Down Expand Up @@ -1167,6 +1167,10 @@ function gtm4wp_woocommerce_get_product_list_item_extra_tag( $product, $listtype
'productlist'
);

if ( $eec_product_array === false ) {
return false;
}

if ( ! isset( $eec_product_array['item_brand'] ) ) {
$eec_product_array['item_brand'] = '';
}
Expand Down

0 comments on commit e162625

Please sign in to comment.