Settings
The admin settings API allows you to do the following:
fetch setting sections
fetch a section's list of fields
read, update and delete setting options for ACFW.
GET: /wp-json/coupons/v1/settings/sections
Fetch all sections of ACFW settings.
Requirements:
Logged-in user
user role with
manage_woocommerceuser capability
Method
Endpoint
GET
/wp-json/coupons/v1/settings/sections
Request Headers
Required
Type
Description
section
false
string
Slug of the current section.
When filled, it will preload the section's fields.
Get all sections
GET: http://example.com/wp-json/coupons/v1/settings/sectionsPreload fields for a specified section
GET: http://example.com/wp-json/coupons/v1/settings/sections
Custom Headers JSON
{
"section": "bogo_deals_section"
}Status: 200 OK
Get all setting sections.
[
{
"id": "general_section",
"title": "General",
"fields": [],
"show": true,
"module": false
},
{
"id": "bogo_deals_section",
"title": "BOGO Deals",
"fields": [],
"show": true,
"module": "acfw_bogo_deals_module"
},
{
"id": "scheduler_section",
"title": "Scheduler",
"fields": [],
"show": true,
"module": "acfw_scheduler_module"
},
{
"id": "role_restrictions_section",
"title": "Role Restrictions",
"fields": [],
"show": true,
"module": "acfw_role_restrict_module"
},
{
"id": "url_coupons_section",
"title": "URL Coupons",
"fields": [],
"show": true,
"module": "acfw_url_coupons_module"
},
{
"id": "modules_section",
"title": "Modules",
"fields": [],
"show": true,
"module": false
}
]Get all setting sections and load fields for current section
[
{
"id": "general_section",
"title": "General",
"fields": [],
"show": true,
"module": false
},
{
"id": "bogo_deals_section",
"title": "BOGO Deals",
"fields": [
{
"title": "BOGO Deals",
"type": "title",
"desc": "",
"id": "acfw_bogo_deals_main_title",
"value": false
},
...fields
],
"show": true,
"module": "acfw_bogo_deals_module"
},
{
"id": "scheduler_section",
"title": "Scheduler",
"fields": [],
"show": true,
"module": "acfw_scheduler_module"
},
{
"id": "role_restrictions_section",
"title": "Role Restrictions",
"fields": [],
"show": true,
"module": "acfw_role_restrict_module"
},
{
"id": "url_coupons_section",
"title": "URL Coupons",
"fields": [],
"show": true,
"module": "acfw_url_coupons_module"
},
{
"id": "modules_section",
"title": "Modules",
"fields": [],
"show": true,
"module": false
}
]Status: 403 Forbidden
{
"code": "rest_forbidden_context",
"message": "Sorry, you are not allowed access to this endpoint.",
"data": {
"status": 401
}
}GET: /wp-json/coupons/v1/settings/sections/{section_id}
Get fields for a given setting section
Requirements:
Logged-in user
user role with
manage_woocommerceuser capability
Method
Endpoint
GET
/wp-json/coupons/v1/settings/sections/{section_id}
Get fields for general section
GET: http://example.com/wp-json/coupons/v1/settings/sections/generalStatus: 200 OK
Get fields for general section
{
"id": "general_section",
"fields": [
{
"title": "General",
"type": "title",
"desc": "",
"id": "acfw_general_main_title",
"value": false
},
{
"title": "Default coupon category",
"type": "select",
"desc_tip": "If a coupon is saved without specifying a category, give it this default category. This is useful when third-party tools create coupons or for coupons created via API.",
"id": "acfw_default_coupon_category",
"class": "wc-enhanced-select",
"placeholder": "Select a category",
"taxonomy": "shop_coupon_cat",
"options": [
{
"key": 55,
"label": "BOGO coupons"
},
{
"key": 35,
"label": "Redeemed"
},
{
"key": 19,
"label": "Uncategorized"
},
{
"key": 54,
"label": "User Owned"
}
],
"value": "19"
}
]
}Status: 403 Forbidden
{
"code": "rest_forbidden_context",
"message": "Sorry, you are not allowed access to this endpoint.",
"data": {
"status": 401
}
}GET: /wp-json/coupons/v1/settings/{setting_id}
Get the value of an ACFW setting option.
Method
Endpoint
GET
/wp-json/coupons/v1/settings/{setting_id}
Get the value of a BOGO Deals global notice message setting value.
GET: http://example.com/wp-json/coupons/v1settings/acfw_bogo_deals_notice_messageStatus: 200 OK
Get the value of a BOGO Deals global notice message setting value.
{
"id": "acfw_bogo_deals_notice_message",
"value": "Your current cart is eligible to redeem deals"
}Status: 403 Forbidden
{
"code": "rest_forbidden_context",
"message": "Sorry, you are not allowed access to this endpoint.",
"data": {
"status": 401
}
}PUT: /wp-json/coupons/v1/settings/{setting_id}
Update value of an ACFW setting option.
Requirements:
Logged-in user
user role with
manage_woocommerceuser capability
Method
Endpoint
PUT
/wp-json/coupons/v1/settings/{setting_id}
Query Parameters
Required
Type
Description
value
true
mixed
Value to update
type
false
string
Format type of value.
Default as string
Update value of BOGO Deals: Global notice button text setting option.
PUT: http://example.com/wp-json/coupons/v1/settings/acfw_bogo_deals_notice_button_text
JSON Body:
{
value: "View Deals",
type: "text"
}Disable Sort Coupons in Cart module
PUT: http://example.com/wp-json/coupons/v1/settings/acfw_sort_coupons_module
JSON Body:
{
value: "",
type: "module"
}Status: 200 OK
Update value of BOGO Deals: Global notice button text setting option.
{
"id":"acfw_bogo_deals_notice_button_text",
"value":"View Deals"
}Disable Sort Coupons in Cart module
{
"id":"acfw_sort_coupons_module",
"value":""
}Update Spending over a threshold (breakpoints) setting
Status: 403 Forbidden
{
"code": "rest_forbidden_context",
"message": "Sorry, you are not allowed access to this endpoint.",
"data": {
"status": 401
}
}DELETE: /wp-json/coupons/v1/settings/{setting_id}
Update value of an ACFW setting option.
Requirements:
Logged-in user
user role with
manage_woocommerceuser capability
Method
Endpoint
DELETE
/wp-json/coupons/v1/settings/{setting_id}
Get value for BOGO Deals: Global notice button text setting option.
DELETE: http://example.com/wp-json/loyalty-program/v1/settings/acfw_bogo_deals_notice_button_text
Status: 200 OK
Delete Price to points earned ratio setting option.
{
"updated": true,
"previous": {
"id": "acfw_bogo_deals_notice_button_text",
"value": "View Deals"
}
}Status: 403 Forbidden
{
"code": "rest_forbidden_context",
"message": "Sorry, you are not allowed access to this endpoint.",
"data": {
"status": 401
}
}Last updated
Was this helpful?