Title: Expected parameter 2 to be an array
Last modified: December 27, 2020

---

# Expected parameter 2 to be an array

 *  Resolved [TomasT](https://wordpress.org/support/users/tomast/)
 * (@tomast)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/expected-parameter-2-to-be-an-array/)
 * Hello<br />First of all, thanks for this great plug in. The GTM tags delivered
   with json, saved a lot of time and is suffiscient as a starting point.
 * This way or another i have few wishes to be added in the next releases if possible.
   
   i wish i could choose the data those are sent with the tag fired. (extend the
   event parameters), i think this could be done in Event.php anyway would be lost
   with every next update of the plugin.
 * I am also facing following problem i am not able to solve ($me->KnowledgePhp 
   =0;)
    i would be happy if you could help me.
 * Warning: array_map(): Expected parameter 2 to be an array, bool given in /data/
   web/virtuals/263156/virtual/www/domains/ultragrey.eu/ext/gtm-ecommerce-woo/lib/
   Util/WcTransformerUtil.php on line 30
 * Warning: Invalid argument supplied for foreach() in /data/web/virtuals/263156/
   virtual/www/domains/ultragrey.eu/ext/gtm-ecommerce-woo/lib/GaEcommerceEntity/
   Item.php on line 83
 * i am not sure, if that is the reason why i dont get any purchases into my analytics,
   even though the tag is firing correctly.
 * next thing i observed is that the add to cart is not working on my instalation.
   
   I extended the tag also with click_class as also click text, but no luck.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fexpected-parameter-2-to-be-an-array%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  [Handcraft Byte](https://wordpress.org/support/users/handcraftbyte/)
 * (@handcraftbyte)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/expected-parameter-2-to-be-an-array/#post-13840938)
 * Hello [@tomast](https://wordpress.org/support/users/tomast/)!
 * Thanks for reaching out and giving some suggestions to the next releases.
    It
   sounds like something we could address by introducing filters that you can hook
   up to and inject your additional parameters. I wonder what are the parameters
   that you would like to add? Maybe it could also be handled in the settings of
   the connector too.
 * Regarding the PHP errors that you have reported it seems we don’t handle an edge
   case where a product isn’t in any category. We will have a deeper look and provide
   you an update later today.
 * Last but not least we had a look at your page but we cannot see the “addToCart”
   snippet at all in the page, we see some separate `ga` calls though. Are you using
   Universal Analytics property or new GA4?
 * If you don’t want to expose too much of details here we can follow up via email
   at [contact@handcraftbyte.com](https://wordpress.org/support/topic/expected-parameter-2-to-be-an-array/contact@handcraftbyte.com?output_format=md)–
   we also try to share some preview versions of plugin like that so you can test
   it before we release public version.
 * Let us know, all the best,
    Handcraft Byte team
 *  [Handcraft Byte](https://wordpress.org/support/users/handcraftbyte/)
 * (@handcraftbyte)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/expected-parameter-2-to-be-an-array/#post-13841664)
 * [@tomast](https://wordpress.org/support/users/tomast/) we published a version
   which should handle the edge case that product does not have categories correctly.
   Let us know if that helps with some of the problems reported. Btw. we couldn’t
   get WooCommerce into such state when using Admin Panel, trying to save a product
   without category assigns it to “Uncategorised”, we wonder how you ended up in
   such situation?
 *  Thread Starter [TomasT](https://wordpress.org/support/users/tomast/)
 * (@tomast)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/expected-parameter-2-to-be-an-array/#post-13842367)
 * Hello,
    thanks a lot, the PHP problem is with the new update solved.
 * Regarding the UA i am using both, GA4 is bound via GTM, UA is via gtag.
    i also
   wish your plugin gather some visitor details, those could be used for some ads.
 * I am completely new in this area, just trying to find a new life goals.
 * Thanks for your help.
    Tomas
 *  Thread Starter [TomasT](https://wordpress.org/support/users/tomast/)
 * (@tomast)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/expected-parameter-2-to-be-an-array/#post-13850012)
 * Hello,
    seems like the PHP problem is not fully solved. i found another problem
   when buying with nested item, the same error shows up. Thanks Tomas
 *  [Handcraft Byte](https://wordpress.org/support/users/handcraftbyte/)
 * (@handcraftbyte)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/expected-parameter-2-to-be-an-array/#post-13879036)
 * Hello [@tomast](https://wordpress.org/support/users/tomast/),
 * sorry for long response time due to holidays.
 * We will have a look into this case and issue a fix. We will let you know once
   it’s available.
 * All the best,
    Handcraft Byte
 *  [Handcraft Byte](https://wordpress.org/support/users/handcraftbyte/)
 * (@handcraftbyte)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/expected-parameter-2-to-be-an-array/#post-13899142)
 * Hello [@tomast](https://wordpress.org/support/users/tomast/),
 * can you retry your test again on the latest version of the plugin?
 * If it does not help can you provide us with more details about how you end up
   having this error? What are the product setup, items, and categories?
 * Coming back to additional attributes, we can introduce a custom filter that you
   can hook up or we can build in some behavior. What are some specific properties
   that you would like to track about your visitors?
 * All the best,
    Handcraft Byte
 *  [Handcraft Byte](https://wordpress.org/support/users/handcraftbyte/)
 * (@handcraftbyte)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/expected-parameter-2-to-be-an-array/#post-14046429)
 * [@tomast](https://wordpress.org/support/users/tomast/) we are closing this topic
   since the bug was apparently fixed and for further improvements, we would need
   more of your input.
    Feel free to open another ticket or contact us directly 
   at [contact@handcraftbyte.com](https://wordpress.org/support/topic/expected-parameter-2-to-be-an-array/contact@handcraftbyte.com?output_format=md).
 * All the best,
    andcraft Byte

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

The topic ‘Expected parameter 2 to be an array’ is closed to new replies.

 * ![](https://ps.w.org/gtm-ecommerce-woo/assets/icon-256x256.png?rev=3189876)
 * [Tag Pilot FREE - Google Tag Manager Integration for WooCommerce](https://wordpress.org/plugins/gtm-ecommerce-woo/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gtm-ecommerce-woo/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gtm-ecommerce-woo/)
 * [Active Topics](https://wordpress.org/support/plugin/gtm-ecommerce-woo/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gtm-ecommerce-woo/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gtm-ecommerce-woo/reviews/)

## Tags

 * [Invalid argument supplied](https://wordpress.org/support/topic-tag/invalid-argument-supplied/)

 * 7 replies
 * 2 participants
 * Last reply from: [Handcraft Byte](https://wordpress.org/support/users/handcraftbyte/)
 * Last activity: [5 years, 3 months ago](https://wordpress.org/support/topic/expected-parameter-2-to-be-an-array/#post-14046429)
 * Status: resolved