Skip to content

Instantly share code, notes, and snippets.

@kreamweb
Created June 13, 2017 08:28
Show Gist options
  • Select an option

  • Save kreamweb/4dbec9aa284e163c6b6d5aa7efdc3e95 to your computer and use it in GitHub Desktop.

Select an option

Save kreamweb/4dbec9aa284e163c6b6d5aa7efdc3e95 to your computer and use it in GitHub Desktop.
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;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment