Month: November 2017

woocommerce

Display coupons used in an order in woocommerce

Use any order hooks.  here we get the deatils of coupen once cancelled the order from orders list add_action(‘woocommerce_order_status_cancelled’, ‘order_cancelled_woo’); order_cancelled_woo($order_id){ $order = new WC_Order($order_id); $coupens= $order->get_used_coupons(); file_put_contents(‘filename1.txt’,print_r($coupens,true)); }