• Resolved fabscanta

    (@fabscanta)


    Hi,

    When using the fantastic GTM plugin by Duracelltomi with WooCommerce, I found a notice message on the product page.

    To reproduce this notice:
    * WooCommerce plugin is activated
    * Activate the debug display on site
    * View a product page

    Here the PHP notice:
    [14-Dec-2016 09:01:15 UTC] PHP Notice: Undefined variable: gtm4wp_options in /(...)/wp-content/plugins/duracelltomi-google-tag-manager/integration/woocommerce.php on line 414

    I think this behaviour is largely encountered:
    https://www.google.com/search?q=Notice:+Undefined+variable:+gtm4wp_options+in+/wp-content/plugins/duracelltomi-google-tag-manager/integration/woocommerce.php+on+line+414

    I suggest to add set $gtm4wp_options as global:

    --- a/wp-content/plugins/duracelltomi-google-tag-manager/integration/woocommerce.php
    +++ b/wp-content/plugins/duracelltomi-google-tag-manager/integration/woocommerce.php
    @@ -406,6 +406,7 @@
     }
     
     function gtm4wp_woocommerce_single_add_to_cart_tracking() {
    +  global $gtm4wp_options;
     	if ( ! is_single() ) {
     		return;
     	}

    Please, let me know if I’m right?

    Thanks.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Notice: Undefined variable: gtm4wp_options’ is closed to new replies.