• Resolved faca5

    (@faca5)


    Hello.

    Plugin “WooCommerce Google Ads Conversion Tracking” is not compatible with latest version of WordPress 5.7.0.

    Error:
    Notice: WP_Scripts::localize je bil zahtevan nepravilno. The $l10n parameter must be an array. To pass arbitrary data to scripts, use the wp_add_inline_script() function instead. Prosimo preberite Debugging in WordPress za ve? informacij. (To sporo?ilo je bilo dodano v izdaji 5.7.0.)

    File:
    plugins/woocommerce-google-adwords-conversion-tracking-tag/classes/pixels/class-google-pixel-manager.php

    Line:
    wooptpmDataLayer[‘visible_products’] = <!DOCTYPE html>

    wooptpmDataLayer[‘visible_products’] = <?php
    echo json_encode( $this->eec_get_visible_products( $visible_product_ids ) ) ;

    Please can you fix?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter faca5

    (@faca5)

    Solution!

    Add if(gettype($product) == ‘object’) {.

    private function eec_get_visible_products( $product_ids ) : array
        {
            $data = [];
            $position = 1;
            foreach ( $product_ids as $key => $product_id ) {
                $product = wc_get_product( $product_id );
    			if(gettype($product) == 'object') {
    				$data[$product->get_id()] = [
    					'id'       => (string) $product->get_id(),
    					'sku'      => (string) $product->get_sku(),
    					'name'     => (string) $product->get_name(),
    					'price'    => (string) $product->get_price(),
    					'brand'    => $this->get_brand_name( $product->get_id() ),
    					'category' => (array) $this->get_product_category( $product->get_id() ),
    					'quantity' => (int) 1,
    					'position' => (int) $position,
    				];
    				$position++;
    			}
            }
            return $data;
        }
    Thread Starter faca5

    (@faca5)

    Problem was related with 1 product which wasn’t object.

    Plugin Author alekv

    (@alekv)

    Hi @faca5

    This has already been fixed in our development environment and will be released with the next version in the next few days.

    Regards
    Aleks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WP_Scripts::localize’ is closed to new replies.