Skip to main content
Bumped by Community user
added 15 characters in body
Source Link

Im trying to get orders in WooCommerce (ideally through wc_get_orders) where the coupon code "some_code" was used.

My try:

function get_orders_with_coupon($coupon){ $customer_orders = wc_get_orders(array( 'limit' => -1, 'coupon' => $coupon )); return $customer_orders; }

function get_orders_with_coupon($coupon){
    $customer_orders = wc_get_orders(array(
        'limit' => -1,
        'coupon' => $coupon
    ));
    return $customer_orders;
}

Only one code is used in Woo orders.

Im trying to get orders in WooCommerce (ideally through wc_get_orders) where the coupon code "some_code" was used.

My try:

function get_orders_with_coupon($coupon){ $customer_orders = wc_get_orders(array( 'limit' => -1, 'coupon' => $coupon )); return $customer_orders; }

Only one code is used in Woo orders.

Im trying to get orders in WooCommerce (ideally through wc_get_orders) where the coupon code "some_code" was used.

My try:

function get_orders_with_coupon($coupon){
    $customer_orders = wc_get_orders(array(
        'limit' => -1,
        'coupon' => $coupon
    ));
    return $customer_orders;
}

Only one code is used in Woo orders.

Source Link

How to get orders with used coupon in WooCommerce

Im trying to get orders in WooCommerce (ideally through wc_get_orders) where the coupon code "some_code" was used.

My try:

function get_orders_with_coupon($coupon){ $customer_orders = wc_get_orders(array( 'limit' => -1, 'coupon' => $coupon )); return $customer_orders; }

Only one code is used in Woo orders.