Title: Bug in code
Last modified: April 9, 2021

---

# Bug in code

 *  Resolved [drodrig](https://wordpress.org/support/users/drodrig/)
 * (@drodrig)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/bug-in-code-6/)
 * Hi.
 * I believe I found a bug in your code. On line 236 of classes/pixels/lass-google-
   pixel-manager.php, you have a $product->get_id() call.
 * The problem is that the $product can be non-existent (False), since the product
   ids you gather include upsells and related products. These products can get deleted
   by the user and WooCommerce does not update the associated references in related
   products and upsells (until the associated product is saved).
 * The result is a fatal error. I wrote three lines of code as a work-around:
 *     ```
       234         foreach ( $product_ids as $key => $product_id ) {
       235             $product = wc_get_product( $product_id );
       236             if (!$product) {
       237               continue;
       238             }
       239             $data[$product->get_id()] = [
       ```
   
 * Hope this helps.
    -  This topic was modified 5 years, 1 month ago by [drodrig](https://wordpress.org/support/users/drodrig/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [alekv](https://wordpress.org/support/users/alekv/)
 * (@alekv)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/bug-in-code-6/#post-14300859)
 * Hi [@drodrig](https://wordpress.org/support/users/drodrig/)
 * This should be fixed in the current version of the plugin. Which version are 
   you referring to?
 *  Thread Starter [drodrig](https://wordpress.org/support/users/drodrig/)
 * (@drodrig)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/bug-in-code-6/#post-14301818)
 * Got it!
 * I should have updated first. 1.8.18 to 1.8.28 fixes the problem.
 * Thank you.
 *  Plugin Author [alekv](https://wordpress.org/support/users/alekv/)
 * (@alekv)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/bug-in-code-6/#post-14301910)
 * I‘m glad it works now!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Bug in code’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-google-adwords-conversion-tracking-tag/assets/
   icon-256x256.png?rev=2704744)
 * [Pixel Manager for WooCommerce – Conversion Tracking, Google Ads, GA4, TikTok, Dynamic Remarketing](https://wordpress.org/plugins/woocommerce-google-adwords-conversion-tracking-tag/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-google-adwords-conversion-tracking-tag/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-google-adwords-conversion-tracking-tag/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-google-adwords-conversion-tracking-tag/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-google-adwords-conversion-tracking-tag/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-google-adwords-conversion-tracking-tag/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [alekv](https://wordpress.org/support/users/alekv/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/bug-in-code-6/#post-14301910)
 * Status: resolved