I have created in WooCommerce two custom coupon types:
function custom_discount_type( $discount_types ) {
$discount_types['cash_back_fixed'] =__( 'Cash Back fixed discount', 'woocommerce' );
$discount_types['cash_back_percentage'] =__( 'Cash Back Percentage discount', 'woocommerce' );
return $discount_types;
}
add_filter( 'woocommerce_coupon_discount_types', 'custom_discount_type',10, 1);
I would like to get the discount type after Order status is "completed", something like :
function wc_m_move_order_money_to_user( $order_id, $old_status, $new_status ){
if( $order->get_used_coupons() ) {
if ($coupon->type == 'cash_back_fixed'){
$coupons_amont = ???
....
}
}
}
But $coupon->type doesn't work.
How can I get the coupon types used in the order?
And how can I get the original coupon amount?.
Thanks