Last active
December 7, 2016 13:14
-
-
Save davidwilliamdacosta/312c9b12bcbcd0f0781e56f036c26e91 to your computer and use it in GitHub Desktop.
Baixa Estoque de Boleto para PagSeguro e Pagar.me
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 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; | |
if ( !$order_id ) | |
return; | |
$order = new WC_Order( $order_id ); | |
$order->reduce_order_stock(); | |
} | |
add_filter( 'woocommerce_payment_complete_reduce_order_stock', '__return_false' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment