This is a developer-level doc. It’s written for developers who are comfortable with PHP, JavaScript and WordPress hooks. If you aren’t, a Woo agency partner or developer can help. Custom code isn’t covered by our Support Policy, so we can’t write, debug or maintain customizations for you.
The Store API is the public, logged-out API behind the Cart and Checkout blocks and headless storefronts. Name Your Price adds its data under the name_your_price key in extensions. For the authenticated admin API, see REST API.
Prices in responses are in the currency’s smallest unit, like the rest of the Store API: "450" is 4.50. Amounts you send are not: send 4.5, not 450.
Products
↑ Back to topGET /wp-json/wc/store/v1/products/<id>, for a Name Your Price product:
"extensions": {
"name_your_price": {
"is_nyp": true,
"hide_minimum": false,
"prices": {
"suggested_price": "300",
"minimum_price": "100",
"maximum_price": "1000"
}
}
}
suggested_price and maximum_price are null when not set, and minimum_price is 0. Other products have an empty name_your_price object. The response has the default suggested price only, not the full list of suggested price buttons.
Adding to the cart
↑ Back to topSend the amount as nyp with POST /wp-json/wc/store/v1/cart/add-item:
{ "id": 142, "quantity": 1, "nyp": 4.5 }
Send nyp as a JSON number. A string is read in the store’s own number format, so on a store that uses a comma for decimals, "4.50" would be read as 450.
The response is the whole cart. Each Name Your Price item has:
| Field | Holds |
|---|---|
nyp | The entered amount, in the smallest unit. |
edit_in_cart | Whether the customer can change the amount in the cart. |
edit_in_cart_text | The text for that link, such as “Edit amount”. |
If the amount is below the minimum, above the maximum or not a number, the item isn’t added:
| Error code | Status | Message |
|---|---|---|
woocommerce_store_api_invalid_product_price | 400 | The reason, such as “Please enter at least $1.00.” |
Changing the amount in the cart
↑ Back to topSend the cart item’s key and the new amount to POST /wp-json/wc/store/v1/cart/extensions, under the wc-name-your-price namespace:
{
"namespace": "wc-name-your-price",
"data": { "key": "f12fc7bd64fe8b33ae8b64b1bd2a1f49", "nyp": 7 }
}
As when adding to the cart, send nyp as a JSON number. The response is the updated cart. Check the item’s edit_in_cart first: when it’s false, the store doesn’t allow the change.
The update namespace is wc-name-your-price, with hyphens. The data in responses is under name_your_price, with underscores.
| Error code | Status | Message |
|---|---|---|
woocommerce_rest_cart_invalid_price | 400 | “Strawberry Soda” price cannot be modified. Please enter at least $1.00. |
Checking the cart at checkout
↑ Back to topEach item’s amount is checked again when the cart is checked, for example at checkout. If an amount is no longer valid, say because the minimum was raised after the item was added, the Store API returns WooCommerce’s woocommerce_cart_error (status 409). Inside it is a woocommerce_store_api_invalid_product_price error such as “”Strawberry Soda” cannot be purchased. Please enter at least $2.00.”
Document Version: 1.0.0
Last Updated: November 9th, 2026
NYP Version Covered: 4.0.0