WordPress at a glance
function is not described

WC_API_Coupons::get_coupons() public WC 2.1

Get all coupons

{} It's a method of the class: WC_API_Coupons{}

No Hooks.

Return

Array.

Usage

$WC_API_Coupons = new WC_API_Coupons();
$WC_API_Coupons->get_coupons( $fields, $filter, $page );
$fields(string)
-
$filter(array)
-
$page(int)
-

Changelog

Since 2.1 Introduced.

Code of WC_API_Coupons::get_coupons() WC 5.0.0

<?php
public function get_coupons( $fields = null, $filter = array(), $page = 1 ) {

	$filter['page'] = $page;

	$query = $this->query_coupons( $filter );

	$coupons = array();

	foreach ( $query->posts as $coupon_id ) {

		if ( ! $this->is_readable( $coupon_id ) ) {
			continue;
		}

		$coupons[] = current( $this->get_coupon( $coupon_id, $fields ) );
	}

	$this->server->add_pagination_headers( $query );

	return array( 'coupons' => $coupons );
}