kreamweb
6/13/2017 - 8:28 AM

how remove the reduction of stock in a renew order

how remove the reduction of stock in a renew order

<?php

if ( class_exists( 'YITH_WC_Subscription' ) ) {

	add_filter( 'woocommerce_can_reduce_order_stock', 'ywsbs_woocommerce_can_reduce_order_stock', 10, 2 );
	function ywsbs_woocommerce_can_reduce_order_stock( $result, $order ) {
		$is_a_renew = yit_get_prop( $order, 'is_a_renew' );

		return ( $is_a_renew == 'yes' ) ? false : $result;
	}
}