dimanche 29 mars 2015

Woocommerce Custom Stock Update after Successful Order

I've a custom database table linked to my Woocommerce tables with some informations like SKU and Stock. I want to add custom function to update this table after successful order (when woocommerce updates product stock). I've tried to do something with this:



add_action( 'woocommerce_reduce_order_stock', 'wpet_testnote' );
function wpet_testnote() {

// Lets grab the order
$order = wc_get_order( $order_id );
$order->add_order_note( 'Stock Updated.' );


I've tried to testing my action with basic order note adding, but but it's not working. Any ideas?


Aucun commentaire:

Enregistrer un commentaire