Title: Undefined variable $key
Last modified: June 28, 2022

---

# Undefined variable $key

 *  Resolved [lexxlevi](https://wordpress.org/support/users/lexxlevi/)
 * (@lexxlevi)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/undefined-variable-key/)
 * Hi
    the plugin now generates an error message Warning: Undefined variable $key
   in …/wp-content/plugins/hide-shipping-method-for-woocommerce/public/class-woo-
   hide-shipping-methods-public.php on line 705
 * Warning: Undefined variable $key in …/wp-content/plugins/hide-shipping-method-
   for-woocommerce/public/class-woo-hide-shipping-methods-public.php on line 722
 * Warning: Undefined variable $key in …/wp-content/plugins/hide-shipping-method-
   for-woocommerce/public/class-woo-hide-shipping-methods-public.php on line 705
 * Warning: Undefined variable $key in …/wp-content/plugins/hide-shipping-method-
   for-woocommerce/public/class-woo-hide-shipping-methods-public.php on line 722
 * It doesn’t affect the website, but it would be nice if the error wasn’t visible
   anymore
    Many thanks for your help!

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

 *  Plugin Support [Hitendra Chopda](https://wordpress.org/support/users/hitendra-chopda/)
 * (@hitendra-chopda)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/undefined-variable-key/#post-15777998)
 * Hello Lexxlevi,
 * Thanks for reaching out to us.
 * Okay, we have reviewed that warning is related to the undefined variable.
 * We will fix it in our next release version.
 * Quick solution: You can do the below small change with mentioned line no to make
   it work.
 * **File path:** “…/wp-content/plugins/hide-shipping-method-for-woocommerce/public/
   class-woo-hide-shipping-methods-public.php”
 * **Line no:** 695
 * Change
 * **From:** `foreach ( $tag_array as $tag ) {`
 * **To:** `foreach ( $tag_array as $key => $tag ) {`
 * Hope the given solution work for you.
 * Best Regards,
    Hitendra & Dotstore Team
 *  Plugin Support [Hitendra Chopda](https://wordpress.org/support/users/hitendra-chopda/)
 * (@hitendra-chopda)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/undefined-variable-key/#post-15828282)
 * Hello Lexxlevi,
 * Hope you are doing well.
 * We have also fixed your query in our latest release version **1.3.2**.
 * Please upgrade and let us know how it works.
 * Best Regards,
    Hitendra & Dotstore Team

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

The topic ‘Undefined variable $key’ is closed to new replies.

 * ![](https://ps.w.org/hide-shipping-method-for-woocommerce/assets/icon-256x256.
   png?rev=3011292)
 * [Hide Shipping Method For WooCommerce](https://wordpress.org/plugins/hide-shipping-method-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/hide-shipping-method-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/hide-shipping-method-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/hide-shipping-method-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/hide-shipping-method-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/hide-shipping-method-for-woocommerce/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Hitendra Chopda](https://wordpress.org/support/users/hitendra-chopda/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/undefined-variable-key/#post-15828282)
 * Status: resolved