Query a list of virtual coupons

GET: /wp-json/coupons/v1/virtualcoupons

Requirements:

  • Logged-in user

  • user role with manage_woocommerce user capability

Method

Endpoint

GET

/wp-json/coupons/v1/virtualcoupons

Query Parameters

Required

Type

Default

Description

search

no

string

Search for virtual codes by name

status

no

string

Valid virtual coupon status (used|pending)

coupon_id

​no

​integer | integer[]

0

​Coupon ID(s)

user_id

no

​integer | integer[]

0

Customer ID(s)

date_created

no

string

A valid date text in mysql format. Y-m-d H:i:s

page

no

integer

1

Current page to load in query.

per_page

no

integer

10

Number of virtual coupons to list in a single page.

sort_by

no

string

date_created

Value to be based for sorting. (code|date_created|id|user_id|status|date_expire)

sort_order

no

string

desc

Order of sorting: desc or asc

codes_only

no

boolean

false

Return list of codes only when set to true.

date_format

no

string

F j, Y g:i a

Date format of virtual coupon date values. See here: https://www.php.net/manual/en/datetime.format.php

Last updated