jamesgol / woocommerce-cart-stock-reducer

Allow WooCommerce inventory stock to be reduced when adding items to cart
GNU General Public License v2.0
58 stars 19 forks source link

Stock Reducer and Composite Product #54

Closed fcom86 closed 3 years ago

fcom86 commented 7 years ago

Hello. I meet unusual problem with this amazing plugin. System Spec: Wordpress 4.8.3 + WC 3.1.2.

I use "WooCommerce Composite Products" to create composite products. And I get the following error at the end of the countdown in composite product:

Fatal error: Uncaught Error: Call to undefined method WC_Cart::get_title() in /srv/www/bestbox.demo/wp-content/plugins/woocommerce-cart-stock-reducer/includes/class-woocommerce-cart-stock-reducer.php:296 Stack trace: #0 /srv/www/bestbox.demo/wp-content/plugins/woocommerce-cart-stock-reducer/includes/class-woocommerce-cart-stock-reducer.php(269): WC_Cart_Stock_Reducer->remove_expired_item('cadcdc0c02db6d7...', Object(WC_Cart)) #1 /srv/www/bestbox.demo/wp-content/plugins/woocommerce-cart-stock-reducer/includes/class-woocommerce-cart-stock-reducer.php(247): WC_Cart_Stock_Reducer->expire_items() #2 /srv/www/bestbox.demo/wp-includes/class-wp-hook.php(298): WC_Cart_Stock_Reducer->check_expired_items(Object(WC_Cart)) #3 /srv/www/bestbox.demo/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters(NULL, Array) #4 /srv/www/bestbox.demo/wp-includes/plugin.php(453): WP_Hook->do_action(Array) #5 /srv/www/bestbox.demo/wp-content/plugins/woocommerce/includes/class-wc-cart.php(255): do_action('woocommerce_car...', Object(WC_Cart)) #6 in /srv/www/bestbox.demo/wp-content/plugins/woocommerce-cart-stock-reducer/includes/class-woocommerce-cart-stock-reducer.php on line 296

How can I fix this error?

jamesgol commented 7 years ago

Can you send me a copy of that plugin? Presumably it's adding items to the cart in a different way that get_title() doesn't exist on that object.

fcom86 commented 7 years ago

@jamesgol I'm not sure about licences of not open source plugins so I send a request about giving a copy to support. Also asked them how it's better to fix this problem. Let's wait for there answer.

jamesgol commented 7 years ago

I'm sure they will say it's not ok to share, but their parent company Automattic stands by the fact that any derivative of WordPress has to be GPL. https://wordpress.org/about/license/

So it's up to you if you want to pass along the code.

fcom86 commented 7 years ago

@jamesgol devs composite plugin send me reply that: "In any case, feel free to pass on your copy of Composite Products to the developer(s) of Cart Stock Reducer so that they can take a look." Can I send copy this plugin to your gnuinter.net mail?

jamesgol commented 7 years ago

Yes you can send a copy there

fcom86 commented 7 years ago

@jamesgol i sent a letter to your mail

jamesgol commented 7 years ago

I have some time today so I'm looking into the issue. Took a bit to figure out that composite product plugin but I get it now. Interesting idea.

It should be easy to get the error fixed, though complete support could be interesting. I'll have to see if there are any odd edge cases that would cause odd behavior.

jamesgol commented 7 years ago

Issue is fixed in development version. Will get a new release pushed out sometime soon after I tackle a couple more things.

Still other complicated issues could exist but I'm not sure it's worth trying to handle them if there isn't any need. For example:

fcom86 commented 7 years ago

Ok, we're waiting for your fix.

jamesgol commented 3 years ago

This should now be resolved with the latest version.