Query a list of virtual coupons
GET: /wp-json/coupons/v1/virtualcoupons
Requirements:
Logged-in user
user role with
manage_woocommerceuser 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
Get virtual coupons for coupon with id of 207
GET: http://example.com/wp-json/coupons1/v1/virtualcoupons?coupon_id=207Get all virtual coupon, but coupon code's only for the main coupon with id of 207
GET: http://example.com/wp-json/coupons1/v1/virtualcoupons?coupon_id=207&codes_only=1&page=-1Status: 200 OK
Get virtual coupons
Get virtual coupon codes only
Status: 403 Forbidden
Last updated
Was this helpful?