Settings
/loyalty-program/v1/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 LPFW. 
GET: /wp-json/wc-loyalty-program/v1/settings/sections
Fetch all sections of LPFW settings.
Requirements:
- Logged-in user 
- user role with - manage_woocommerceuser capability
Method
Endpoint
GET
/wp-json/wc-loyalty-program/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/wc-loyalty-program/v1/settings/sectionsSearching for customers
GET: http://example.com/wp-json/wc-loyalty-program/v1/settings/sections
Custom Headers JSON
{
    "section": "points_earning"
}Status: 200 OK
Get all setting sections.
[
    {
        "id": "general",
        "title": "General",
        "fields": []
    },
    {
        "id": "points_earning",
        "title": "Points Earning",
        "fields": []
    },
    {
        "id": "redemption_expiry",
        "title": "Redemption Expiry",
        "fields": []
    },
    {
        "id": "role_restrictions",
        "title": "Role Restrictions",
        "fields": []
    },
    {
        "id": "help",
        "title": "Help",
        "fields": []
    }
]Get all setting sections and load fields for current section
[
    {
        "id": "general",
        "title": "General",
        "fields": []
    },
    {
        "id": "points_earning",
        "title": "Points Earning",
        "fields": [
            {
                "title": "Points Calculation",
                "type": "subtitle"
            },
            ...fields
        ]
    },
    {
        "id": "redemption_expiry",
        "title": "Redemption Expiry",
        "fields": []
    },
    {
        "id": "role_restrictions",
        "title": "Role Restrictions",
        "fields": []
    },
    {
        "id": "help",
        "title": "Help",
        "fields": []
    }
]Status: 403 Forbidden
{
    "code": "rest_forbidden_context",
    "message": "Sorry, you are not allowed access to this endpoint.",
    "data": {
        "status": 401
    }
}GET: /wp-json/wc-loyalty-program/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/wc-loyalty-program/v1/settings/sections/{section_id}
Get fields for general section
GET: http://example.com/wp-json/wc-loyalty-program/v1/settings/sections/generalStatus: 200 OK
Get fields for general section
{
    "id": "general",
    "fields": [
        {
            "title": "Price to points earned ratio",
            "type": "price",
            "desc_tip": "Define the ratio of points earned for each ₱ spent. Example: Setting a ratio of 1 means 1 point is earned for every ₱1,00 spent. Setting a ratio 5 means 5 points are earned for every ₱1,00 spent.",
            "default": 1,
            "id": "acfw_loyalprog_cost_points_ratio",
            "value": 10
        },
        {
            "title": "Points to price redeemed ratio",
            "type": "number",
            "desc_tip": "Define the worth of each point. Example: Setting a points to price redeemed ratio of 1 means 1 point is worth ₱1,00. Setting a ratio of 10 means 10 points is worth ₱1,00.",
            "default": 10,
            "id": "acfw_loyalprog_redeem_points_ratio",
            "min": 1,
            "value": 1
        },
        {
            "title": "Points name",
            "type": "text",
            "desc_tip": "By default, points are called “Points” throughout the store. You can override the name of your points here.",
            "placeholder": "Points",
            "id": "acfw_loyalprog_points_name",
            "value": "Points"
        }
    ]
}Status: 403 Forbidden
{
    "code": "rest_forbidden_context",
    "message": "Sorry, you are not allowed access to this endpoint.",
    "data": {
        "status": 401
    }
}GET: /wp-json/wc-loyalty-program/v1/settings/{lpfw_option_name}
Get value for a LPFW setting option.
Method
Endpoint
GET
/wp-json/wc-loyalty-program/v1/settings/{lpfw_option_name}
Get value for Price to points earned ratio setting option.
GET: http://example.com/wp-json/wc-loyalty-program/v1/settings/acfw_loyalprog_cost_points_ratioStatus: 200 OK
Get value for Price to points earned ratio setting option.
{
    "id": "acfw_loyalprog_cost_points_ratio",
    "value": "10"
}Status: 403 Forbidden
{
    "code": "rest_forbidden_context",
    "message": "Sorry, you are not allowed access to this endpoint.",
    "data": {
        "status": 401
    }
}PUT: /wp-json/wc-loyalty-program/v1/settings/{lpfw_option_name}
Update value of a LPFW setting option.
Requirements:
- Logged-in user 
- user role with - manage_woocommerceuser capability
Method
Endpoint
PUT
/wp-json/wc-loyalty-program/v1/settings/{lpfw_option_name}
Query Parameters
Required
Type
Description
value
true
mixed
Value to update
type
false
string
Format type of value.
Default as string
Get value for Price to points earned ratio setting option.
PUT: http://example.com/wp-json/wc-loyalty-program/v1/settings/acfw_loyalprog_cost_points_ratio
JSON Body:
{
    "value": 15,
    "type": number
}Update Points calculation options setting
PUT: http://example.com/wp-json/wc-loyalty-program/v1/settings/acfw_loyalprog_points_calculation_options
JSON Body:
{
    "value": {
        "tax": "yes", 
        "shipping": "", 
        "discounts": "yes", 
        "fees": "yes"
    }, 
    "type": "points_calculation"
}Update Spending over a threshold (breakpoints) setting
PUT:http://example.com/wp-json/wc-loyalty-program/v1/settings/acfw_loyalprog_earn_points_amount_breakpoints
JSON Body:
{
    "value": [
        {
            "amount": "10",
            "points": 10
        },
        {
            "amount": "20.50",
            "points": 20
        },
        {
            "amount": "40.60",
            "points": 40
        }
    ],
    "type": "breakpoints"
}Update Extra points to earn during period setting
PUT: http://example.com/wp-json/wc-loyalty-program/v1/settings/acfw_loyalprog_earn_points_order_period
JSON Body:
{
    value: [
        {
            "sdate":"04/04/2021",
            "stime":"01:38 pm",
            "edate":"04/08/2021",
            "etime":"01:38 pm",
            "points":"25"
        },{
            "sdate":"04/05/2021",
            "stime":"01:38 pm",
            "edate":"04/08/2021",
            "etime":"01:38 pm",
            "points":10
        }
    ]
    type: "order_period",
}Status: 200 OK
Update value of Price to points earned ratio setting option to 15.
{
    "id": "acfw_loyalprog_cost_points_ratio",
    "value": "10"
}Update Points calculation options setting
{
    "id": "acfw_loyalprog_points_calculation_options",
    "value": {
        "tax": "yes",
        "shipping": "",
        "discounts": "yes",
        "fees": "yes"
    }
}Update Spending over a threshold (breakpoints) setting
{
    "id": "acfw_loyalprog_earn_points_amount_breakpoints",
    "value": [
        {
            "amount": "10",
            "points": 10,
            "sanitized": 10
        },
        {
            "amount": "20.5",
            "points": 20,
            "sanitized": 20.5
        },
        {
            "amount": "40.6",
            "points": 40,
            "sanitized": 40.6
        }
    ]
}Update Extra points to earn during period setting
{
    "id": "acfw_loyalprog_earn_points_order_period",
    "value": [
        {
            "sdate": "04/04/2021",
            "stime": "01:38 pm",
            "edate": "04/08/2021",
            "etime": "01:38 pm",
            "points": 25
        },
        {
            "sdate": "04/05/2021",
            "stime": "01:38 pm",
            "edate": "04/08/2021",
            "etime": "01:38 pm",
            "points": 10
        }
    ]
}Status: 403 Forbidden
{
    "code": "rest_forbidden_context",
    "message": "Sorry, you are not allowed access to this endpoint.",
    "data": {
        "status": 401
    }
}DELETE: /wp-json/wc-loyalty-program/v1/settings/{lpfw_option_name}
Update value of a LPFW setting option.
Requirements:
- Logged-in user 
- user role with - manage_woocommerceuser capability
Method
Endpoint
DELETE
/wp-json/wc-loyalty-program/v1/settings/{lpfw_option_name}
Get value for Price to points earned ratio setting option.
DELETE: http://example.com/wp-json/wc-loyalty-program/v1/settings/acfw_loyalprog_cost_points_ratio
Status: 200 OK
Delete Price to points earned ratio setting option.
{
    "updated": true,
    "previous": {
        "id": "acfw_loyalprog_cost_points_ratio",
        "value": "10"
    }
}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?
