Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mehrshaddarzi/ece0482efe0095aaa067248b888a9917 to your computer and use it in GitHub Desktop.
Save mehrshaddarzi/ece0482efe0095aaa067248b888a9917 to your computer and use it in GitHub Desktop.
Disable Coupon Usage for Pending Order
<?php
// https://github.com/woocommerce/woocommerce/issues/27673
add_action('plugins_loaded', function(){
remove_action( 'woocommerce_order_status_pending', 'wc_update_coupon_usage_counts');
});
//add_filter( 'woocommerce_hold_stock_for_checkout', function() { return false; } );
function woo_set_coupon_hold_minutes( $mins ) {
$mins = 0;
return $mins;
};
add_filter( 'woocommerce_coupon_hold_minutes', 'woo_set_coupon_hold_minutes', 50, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment