Advanced Coupons API
  • REST API
  • coupons/v1
    • Virtual Coupons (Premium)
      • Query a list of virtual coupons
      • Fetch virtual coupon stats
      • Create a virtual coupon
      • Retrieve a virtual coupon
      • Update a virtual coupon
      • Delete a virtual coupon
      • Bulk create virtual coupons
      • Bulk delete virtual coupons
    • Search Customers (Premium)
    • Settings
  • loyalty-program/v1
    • Dashboard
    • Customers
    • Settings
    • My Points
  • wc-loyalty-program/v1
    • Dashboard
    • Customers
    • Settings
  • wc-store-credits/v1
    • Entries
      • Query a list of store credit entries
      • Create a store credit entry
      • Fetch a single store credit entry
      • Update store credit entry
      • Delete store credit entry
    • Customers
      • Get dashboard statistics data
      • Query list of customers with store credits balance
      • Get single customer statistics and sources
Powered by GitBook
On this page

Was this helpful?

  1. coupons/v1
  2. Virtual Coupons (Premium)

Update a virtual coupon

PUT: /wp-json/coupons/v1/virtualcoupons/‌{virtual_coupon_id}

Requirements:

  • Logged-in user

  • user role with manage_woocommerce user capability

Method

Endpoint

PUT

/wp-json/coupons/v1/virtualcoupons/‌{virtual_coupon_id}

Query Parameters

Required

Type

Description

status

no

string

Valid virtual coupon status: pending or used

date_created

no

string

Date and time of virtual coupon was created

date_expire

no

string

Date and time for virtual coupon to be marked as expired.

user_id

no

integer

Customer ID

date_format

no

string

Date format of the provided date values

Update virtual coupon status

PUT: http://example.com/wp-json/coupons/v1/virtualcoupons/‌467

JSON Body:
{
    "status": "used"
}

Update virtual coupon status and date expire

PUT: http://example.com/wp-json/coupons/v1/virtualcoupons/‌467

JSON Body:
{
    "status": "used",
    "date_expire": "January 1, 2022 10:00 am",
    "date_format": "F j, Y g:i a"
}

Status: 200 OK

Update virtual coupon status

{
  "message": "Successfully updated virtual coupon.",
  "data": {
    "key": "467",
    "id": 467,
    "code": "S4WXTUG8DT",
    "main_code": "bogo1",
    "coupon_code": "bogo1-s4wxtug8dt",
    "status": "used",
    "coupon_id": 207,
    "user_id": 0,
    "user_fullname": "",
    "user_email": "",
    "date_created": "June 28, 2021 1:48 pm",
    "date_expire": ""
  }
}

Update virtual coupon status and date expire

{
  "message": "Successfully updated virtual coupon.",
  "data": {
    "key": "467",
    "id": 467,
    "code": "S4WXTUG8DT",
    "main_code": "bogo1",
    "coupon_code": "bogo1-s4wxtug8dt",
    "status": "used",
    "coupon_id": 207,
    "user_id": 0,
    "user_fullname": "",
    "user_email": "",
    "date_created": "June 28, 2021 1:48 pm",
    "date_expire": "January 1, 2022 10:00 am"
  }
}

Status: 403 Forbidden

{
    "code": "rest_forbidden_context",
    "message": "Sorry, you are not allowed access to this endpoint.",
    "data": {
        "status": 401
    }
}
PreviousRetrieve a virtual couponNextDelete a virtual coupon

Last updated 3 years ago

Was this helpful?