Name Your Price: Store API

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 top

GET /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 cart

↑ Back to top

Send the customer’s price as nyp, in the smallest unit of the currency, the same way the Store API returns prices.

  • For a store with 2 decimals, send 750 for 7.50.
  • For a store with no decimals (such as JPY), send 750 for ¥750.

nyp must be a whole number, either a JSON integer or a string of digits. A decimal such as 7.50 or 7,50 is refused with a 400 error.

POST /wp-json/wc/store/v1/cart/add-item
{ "id": 123, "quantity": 1, "nyp": 750 }

The price is then checked against the product’s minimum and maximum. A price outside them returns a 400 error with the store’s message.

Changed in 4.0.0: versions 3.5.0 to 3.8.x took nyp in major units (7.50). Update any client that sends major units. Decimals are now refused, and a whole number like 7 would be read as 0.07.

Editing the price in the cart

↑ Back to top

To change an item’s price, send extensionCartUpdate with:

  • the namespace wc-name-your-price
  • the item’s key
  • nyp in the smallest unit of the currency, as in add to cart
wc.blocksCheckout.extensionCartUpdate( {
	namespace: 'wc-name-your-price',
	data: { key: cartItemKey, nyp: 999 }, // 9.99
} );

Or send a request directly:

POST /wp-json/wc/store/v1/cart/extensions
{ "namespace": "wc-name-your-price", "data": { "key": "…", "nyp": 999 } }

The cart item’s extensions.name_your_price.nyp in Store API responses uses the same units. You can show it with the cart’s currency settings and send it back unchanged.


Document Version: 1.0.0
Last Updated: November 18th, 2026
NYP Version Covered: 4.0.0

Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.