Title: Empty Cart Button creating multiple database errors
Last modified: September 23, 2021

---

# Empty Cart Button creating multiple database errors

 *  Resolved [max_Q](https://wordpress.org/support/users/max_q/)
 * (@max_q)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/empty-cart-button-creating-multiple-database-errors/)
 * Hi,
 * Your function, prowc_empty_cart_button_check_version(), is evaluating plugin 
   version 1.3.3 to be less than version 1.3.0, leading it to run on every page 
   load.
 * Since the first time it runs it creates all the database keys it’s going to create,
   every additional run throws duplicate entry database errors. Over one hundred
   on my client’s site on every page load.
 * Also, it seems the logic is flawed. It’s looking for options keys that start 
   with “alg_wc_”, from when the plugin belonged to Algoritmika, and migrates them
   to “prowc_”. But Algoritmika had lots of plugins, not just Empty Cart Button,
   and when there’s more than just your plugin installed your function grabs options
   keys from all the other Algoritmika plugins and creates versions of them prefixed
   with “prowc_”. On my client’s site that’s 115 options keys created for non-existent
   plugins.
 * I’ve had to deactivate your plugin on my client’s site. I’ll keep an eye on your
   changelogs going forward.

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

 *  Plugin Author [prowcplugins](https://wordpress.org/support/users/prowcplugins/)
 * (@prowcplugins)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/empty-cart-button-creating-multiple-database-errors/#post-14975535)
 * Hi,
 * I have reviewed your ticket and working on this. Will update our plugin’s next
   version soon with fixed this issue
 * Thanks!
 *  [Guyinpv](https://wordpress.org/support/users/guyinpv/)
 * (@guyinpv)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/empty-cart-button-creating-multiple-database-errors/#post-15493935)
 * [@prowcplugins](https://wordpress.org/support/users/prowcplugins/) Thanks, I 
   just had a related issue here too. It should have been updated 5 months ago!
   
   The problem is in `prowc_empty_cart_button_check_version()` function, you are
   referencing `global $version` and this returns NULL because $version is not global.
   This is inside a class, it should be referenced as `$this->version`. The correct
   code would be:
 *     ```
       function prowc_empty_cart_button_check_version() {
        if (version_compare($this->version, '1.3.0', '<')) {...}
       }
       ```
   
 * Maybe I shouldn’t assume `global $version` is always wrong, maybe that works 
   sometimes in some environments? But for me, since this is in an instantiated 
   class, `$this->version` returned the version number, otherwise it was NULL.
    
   This issue was marked resolved by I don’t know how, as both the version check
   and the database renaming are still a problem in 1.3.4.
 * Also, the maker “Algoritmika” was mentioned. In my case the other plugin that
   got “caught up” in the key renaming problem was by a plugin “Product Prices by
   User Roles for WooCommerce” by Tyche Softwares. It also uses “alg_wc_” key names.
   This lead to the same massive debug log file of duplicate key issues.
 * Please at least fix the version check problem as that will prevent the DB issues
   for anybody using the latest version.
 * Thanks!
    -  This reply was modified 4 years, 2 months ago by [Guyinpv](https://wordpress.org/support/users/guyinpv/).
      Reason: clarification

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

The topic ‘Empty Cart Button creating multiple database errors’ is closed to new
replies.

 * ![](https://s.w.org/plugins/geopattern-icon/empty-cart-button-for-woocommerce_884e82.
   svg)
 * [Empty Cart Button for WooCommerce](https://wordpress.org/plugins/empty-cart-button-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/empty-cart-button-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/empty-cart-button-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/empty-cart-button-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/empty-cart-button-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/empty-cart-button-for-woocommerce/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [Guyinpv](https://wordpress.org/support/users/guyinpv/)
 * Last activity: [4 years, 2 months ago](https://wordpress.org/support/topic/empty-cart-button-creating-multiple-database-errors/#post-15493935)
 * Status: resolved