Name Your Price v3.8.0 – Edit in Cart Rework, Product Caching Compatibility & WooCommerce 10.9

Name Your Price 3.8.0 reworks how a customer changes the price of an item that is already in the cart. The existing line is now replaced only after the new price has been accepted, the “Cart updated.” notice appears only when the edit went through, and a new filter lets stores that use side-cart or mini-cart plugins skip the redirect to the cart page. The release also declares compatibility with WooCommerce’s Cache Product Objects feature, is tested with WooCommerce 10.9.0 and WordPress 7.0.0, and tidies up a duplicate settings section ID and the way validation messages are decoded. There is no database update with this release.

Updates

Tested with WooCommerce 10.9 and WordPress 7.0

Name Your Price 3.8.0 is tested with WooCommerce 10.9.0 and WordPress 7.0.0. Minimum requirements are unchanged: WordPress 6.2, WooCommerce 8.2 and PHP 7.4.

Reworked Edit in Cart flow

When a customer selects Edit price on a Name Your Price line in the cart, the product page opens with their current amount filled in and the button reads Update Cart. Before 3.8.0, submitting that form removed the existing cart line first and then added the new one. 3.8.0 reverses the order: the existing line is set aside while the new price goes through validation and WooCommerce’s add-to-cart checks, and once the new line is in the cart the old one is removed. The redirect to the cart page and the “Cart updated.” notice are now tied to that success, so they appear only when the line changed.

The second change is for stores that add to cart over AJAX, which is how most side-cart and mini-cart plugins work. Name Your Price no longer forces a redirect to the cart page on an AJAX request, so those plugins keep control of what the customer sees next. To keep customers on the product page after an edit on every request, add:

add_filter( 'wc_nyp_redirect_to_cart_after_edit', '__return_false' );

The wc_nyp_redirect_to_cart_after_edit filter receives the default (true for a normal form submission, false during AJAX) and applies only to edits. A first-time add to cart still follows your Redirect to the cart page after successful addition setting under WooCommerce → Settings → Products.

Compatible with WooCommerce’s Cache Product Objects feature

Name Your Price now declares compatibility with the Cache Product Objects feature on WooCommerce → Settings → Advanced → Features (product_instance_caching in code). WooCommerce introduced the feature as experimental in 10.5 and switches it on for stores created on 11.0 or later; stores that upgrade keep their existing setting. With it on, repeated wc_get_product() calls within a request are served from an in-memory cache instead of reloading the product from the database, and each caller receives its own copy of the product. Name Your Price sets the customer’s amount on the cart line’s own product instance, so the two do not interfere. On WooCommerce 10.5, where the Features screen listed every plugin without a declaration as incompatible, Name Your Price now shows as compatible; WooCommerce 10.6 and later treat undeclared plugins as compatible by default.

Fixes

Advanced Options settings group has its own ID

The Advanced Options group on WooCommerce → Settings → Name Your Price (home of Enable edit in cart and Enable strict sold-individually) shared its section ID, woocommerce_nyp_options, with the Text strings group above it. The duplicate caused no visible problem on the current settings screen, but it fired WooCommerce’s per-group woocommerce_settings_woocommerce_nyp_options actions (and their _end and _after variants) twice per page load, and WooCommerce’s modern settings framework, introduced in WooCommerce 10.9, treats settings IDs as unique keys. 3.8.0 gives the group its own ID, woocommerce_nyp_advanced_options. No option names change; your saved settings are untouched.

Validation messages decode the same on every PHP version

Name Your Price passes its price validation messages through PHP’s html_entity_decode() before handing them to the Store API (the block cart and checkout), the CoCart integration and the database update notice. PHP 8.1 changed that function’s default flags, so the same message could decode differently on PHP 7.4 and 8.0 than on 8.1 and later. 3.8.0 sets the flags explicitly (ENT_QUOTES with the site’s charset), which also clears the PHP compatibility check in WooCommerce’s Quality Insights Toolkit.

Improvements

Pre-filled prices for inputs that use a field suffix

Integrations that give the Name Your Price input a suffix through the wc_nyp_field_suffix filter (product bundles, composites and ticket-style add-ons do this) now get the matching nyp_raw value pre-filled when the product page loads with a price in the URL, as it does in Edit in Cart and subscription-switch links. WC_Name_Your_Price_Helpers::get_price_value_attr() passes the suffix through to get_initial_price(), which previously received none.

Why this matters

  • Editing a price from the cart replaces the line cleanly, and the confirmation shows only when the change went through
  • Side-cart and mini-cart plugins keep control after a price edit, and a one-line filter turns the cart redirect off entirely
  • Ready for WooCommerce’s product object cache, whether your store already has it on or turns it on later
  • Tested with WooCommerce 10.9 and WordPress 7.0
  • Distinct settings group IDs and validation messages that read the same on every supported PHP version

Similar Posts