Name Your Price: REST 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.

Name Your Price adds its fields to WooCommerce’s own REST API endpoints, so you read and write them with the usual products and orders requests. You need a REST API key or an authenticated user, as for any other product field. For the storefront API used by the Cart and Checkout blocks, see Store API.

Requires Name Your Price 4.0, WooCommerce 9.7 and WordPress 6.5 or newer.

Products

↑ Back to top

GET, POST and PUT on /wp-json/wc/v3/products and /wp-json/wc/v3/products/<id> include these fields:

FieldHolds
nypBoolean. Whether the product is a Name Your Price product.
nyp_minimum_priceString, or false when there’s no minimum. The minimum price.
nyp_maximum_priceString, or false when there’s no maximum. The maximum price.
nyp_suggested_priceString, or false. The default suggested price.
nyp_suggested_pricesArray. The suggested price buttons, one { "price": "3", "default": true } per amount. New in 4.0.
nyp_hide_minimumBoolean. Whether the minimum price is hidden. It’s still enforced.

The product’s own settings from its Name Your Price tab are included too, as nyp_hide_quantity, nyp_suggested_text, nyp_minimum_text, nyp_label_text, nyp_placeholder_text, nyp_button_text, nyp_button_text_single and nyp_button_text_edit. nyp_hide_quantity is a boolean and the rest are strings. An empty value means the store-wide setting applies. New in 4.0.

Example, trimmed to the Name Your Price fields:

{
  "id": 142,
  "name": "Strawberry Soda",
  "nyp": true,
  "nyp_suggested_price": "3",
  "nyp_minimum_price": "1",
  "nyp_maximum_price": "10",
  "nyp_hide_minimum": false,
  "nyp_suggested_prices": [
    { "price": "2", "default": false },
    { "price": "3", "default": true },
    { "price": "5", "default": false }
  ],
  "nyp_label_text": "",
  "nyp_button_text": ""
}

Variations: the /products/<id>/variations endpoints don’t include these fields.

Creating and updating products

↑ Back to top

Send the fields above in a POST or PUT body. For example, to make a product Name Your Price with three suggested amounts:

PUT /wp-json/wc/v3/products/142
{
  "nyp": true,
  "nyp_minimum_price": "1",
  "nyp_maximum_price": "10",
  "nyp_suggested_prices": [
    { "price": "2", "default": false },
    { "price": "3", "default": true },
    { "price": "5", "default": false }
  ]
}
  • Only the fields you send are changed. Send "" to clear a minimum, maximum or suggested price.
  • Suggested prices: amounts that aren’t positive numbers, and duplicates (10 and 10.00), are dropped. A single amount becomes the default. The default amount also sets nyp_suggested_price. Send [] to remove the buttons.
  • Suggested prices are checked against the minimum and maximum already saved. When you change both, update the minimum and maximum first, then the suggested prices.
  • The product’s own settings (nyp_label_text and the others): send "", or false for nyp_hide_quantity, to go back to the store-wide setting.
Error codeStatusWhen
woocommerce_rest_product_nyp_invalid_minimum_price404The request’s minimum is higher than its suggested price.
woocommerce_rest_product_nyp_invalid_maximum_price404The request’s minimum is higher than its maximum.
woocommerce_rest_invalid_suggested_price400A suggested amount is below the saved minimum or above the saved maximum.

Orders

↑ Back to top

GET on /wp-json/wc/v3/orders and /wp-json/wc/v3/orders/<id> adds these fields to each item in line_items. Subscriptions have them too.

FieldHolds
nypBoolean. Whether the item was a Name Your Price product.
nyp_priceNumber, or null. The amount the customer entered, per item. It includes tax when the store enters prices including tax.
nyp_suggested_price
nyp_minimum_price
nyp_maximum_price
Number, or null. The product’s prices when the order was placed. New in 4.0.
"line_items": [
  {
    "name": "Monthly Donation",
    "quantity": 1,
    "subtotal": "27.27",
    "total": "27.27",
    "nyp": true,
    "nyp_price": 30,
    "nyp_suggested_price": 25,
    "nyp_minimum_price": 5,
    "nyp_maximum_price": null
  }
]

Here the customer entered 30 and the store charges 10% tax inside that amount, so the subtotal is 27.27.

Creating an order with an entered price

↑ Back to top

When you create an order with POST /wp-json/wc/v3/orders, send the amount as nyp_price on the line item. Use the order’s currency, and include tax if the store enters prices including tax, just as a customer would type it. Send it as a JSON number. Name Your Price works out subtotal and total unless you send them yourself.

"line_items": [
  { "product_id": 142, "quantity": 1, "nyp_price": 4.50 }
]

The amount is checked against the product’s minimum and maximum in the order’s currency. If it’s outside them, the order isn’t created:

Error codeStatusMessage
woocommerce_rest_invalid_nyp_price400The price entered for “Strawberry Soda” is lower than the minimum allowed price of $1.00. (Or “higher than the maximum”.)

Document Version: 2.0.0
Last Updated: November 9th, 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.