woocommerce / woocommerce-subscriptions-do-not-reduce-stock-on-renewal

Don't reduce a product's inventory for renewal orders processed by WooCommerce Subscriptions.
GNU General Public License v3.0
7 stars 2 forks source link

Pending renewal orders still reduce stock #3

Open NickGreen opened 5 years ago

NickGreen commented 5 years ago

2285271-zd

new customers are unable to purchase the subscription product if there are more pending-payment orders containing the subscription product than the subscription product's true stock quantity. For example, if the subscription product stock is set to 2 but there are 3 pending payment renewal orders for the same subscription product), the perceived stock level will be -1 (2 minus 3).

This appears to be due to WooCommerce's hold-back functionality (see function "wc_get_held_stock_quantity()" used in "WC_Cart->check_cart_item_stock()" method) which does not take into account the "woocommerce_can_reduce_order_stock" filter and our intention for renewal orders to not affect a subscription product's stock.