Skip to content

Instantly share code, notes, and snippets.

View renancmfreitas's full-sized avatar

renancmfreitas

View GitHub Profile
@renancmfreitas
renancmfreitas / gist:01cb079755c9998c3b0dfd226a16e881
Created July 10, 2016 14:31
WooCommerce Auto Restore Stock (modified) - Add function restore pending order
<?php
/**
* Plugin Name: WooCommerce Auto Restore Stock
* Plugin URI: http://gerhardpotgieter.com/tag/woocommerce-auto-restore-stock
* Description: Auto restore stock when orders are cancelled
* Version: 1.0.1
* Author: Gerhard Potgieter
* Author URI: http://gerhardpotgieter.cim
* License: GPL2
*/
/**
* Auto reduce WooCommerce order stock at checkout.
* Add to theme functions.php file
*/
add_action( 'woocommerce_thankyou', 'woocommerce_reduce_order_stock' );
function woocommerce_reduce_order_stock( $order_id ) {
global $woocommerce;