Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecated warning and update function comment #353

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions integration/woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,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 @@ -1263,6 +1263,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