Name Your Price FAQ

Welcome to our FAQ page for the WooCommerce Name Your Price extension! Here, you’ll find answers to common questions about using our plugins, troubleshooting, and best practices. Whether you’re looking for setup guidance, customization tips, or details about our policies, this is your go-to resource. If you can’t find what you’re looking for, feel free to contact our support team for personalized assistance.

How do I change/move the markup?

↑ Back to top

Customizing or relocating markup for the Name Your Price plugin involves working with its templates, hooks, and filters to adapt the plugin’s output to your theme or design preferences.

NOTE:

The following customization is considered Developer level. If you are unfamiliar with code/templates and resolving potential conflicts, select a WooExpert or Developer for assistance. We are unable to provide support for customizations under our  Support Policy.

Changing the markup

↑ Back to top

Similar to WooCommerce, the Name Your Price extension uses a small template part to generate the markup for the minimum price and the price input. For example, you can use your own minimum price template by placing a minimum-product.php inside the /woocommerce/single-product folder of your theme.

You can technically do the same with the price-input.php template, however, much of what makes the Name Your Price component function is wrapped up in helper functions in that template, so only edit this if you really know what you are doing.

Moving the markup

↑ Back to top

The suggested price in displayed in place of the regular price, which by default is attached to the WooCommerce woocommerce_single_product_summary action hook, while the text input is attached to the woocommerce_before_add_to_cart_button hook. The minimum price is attached to the woocommerce_nyp_after_price_input hook.

Following typical WordPress behavior for hooks, to change the location of any of these templates you must remove them from their default hook and add them to a new hook. For example, to relocate the price input place the following in your theme’s functions.php and be sure to adjust the_hook_you_want_to_add_to with your desired hook’s name.

To move the price input:

function nyp_move_price_input(){
  if( class_exists( 'WC_Name_Your_Price_Display' ) ) {
    remove_action( 'woocommerce_before_add_to_cart_button', array( WC_Name_Your_Price()->display, 'display_price_input' ), 9 );
    add_action( 'the_hook_you_want_to_add_to', array( WC_Name_Your_Price()->display, 'display_price_input' ) );
  }
}
add_action( 'woocommerce_before_single_product' , 'nyp_move_price_input' );

To not display a suggested price, you can simply leave the suggested field blank when setting up the product’s meta information. (See the Usage instructions). Similarly, to not enforce a minimum price, leave that field blank when setting up the product information.

How do I remove the stylesheet?

↑ Back to top

The Name Your Price stylesheet is pretty minimal, only offering a tiny bit of styling for the minimum price and for the text input. You can disable it from the plugin’s settings. Go to WooCommerce > Settings dashboard and select the Name Your Price tab.

More details can be found here.

How can I hide the minimum price?

↑ Back to top

NOTE:

The following customization is considered Developer level. If you are unfamiliar with code/templates and resolving potential conflicts, select a WooExpert or Developer for assistance. We are unable to provide support for customizations under our  Support Policy.

The minimum price is attached to the WooCommerce woocommerce_single_product_summary action hook. Following typical WordPress behavior for hooks, to change the location of any of these templates you must remove them from their default hook. For example, to remove the minimum price (and to obfuscate the error messages), you’d place the following in your theme’s functions.php file:

function nyp_remove_minimum_price(){
    remove_action( 'woocommerce_nyp_after_price_input', array( WC_Name_Your_Price()->display, 'display_minimum_price' ) );
}
add_action( 'woocommerce_nyp_before_price_input' , 'nyp_remove_minimum_price' );

function kia_change_minimum_error_templates( $templates ) {
       $templates['minimum'] = __( '"%%TITLE%%" could not be added to the cart: Please enter a higher price.', 'your-plugin-slug' );
       $templates['minimum_js'] = __( 'Please enter a higher price', 'your-plugin-slug' );
       return $templates;
}
add_action( 'woocommerce_nyp_error_message_templates', 'kia_change_minimum_error_templates' );

Force NYP products to be “sold individually”?

↑ Back to top

The same Name Your Price (NYP) enabled product can still be added to cart if the price is different. This is because WooCommerce core generates a unique cart key from the cart item attributes, which includes the NYP price. Because “sold individually” can work a few different ways for people, Name Your Price can’t force one system on all users. Therefore, if you wish to only sell 1 quantity of an item, then there is some custom code that you can use. It’s wrapped up as a plugin so that you can simply install and activate it like any other plugin.

The code and more details can be found here.

How to leave the price input blank?

↑ Back to top

NOTE:

The following customization is considered Developer level. If you are unfamiliar with code/templates and resolving potential conflicts, select a WooExpert or Developer for assistance. We are unable to provide support for customizations under our  Support Policy.

To always force the price input to be initially empty, regardless of the Suggested or Minimum prices, then add the following line to your theme’s functions.php file.

add_filter( 'woocommerce_nyp_get_initial_price', '__return_null' );

Add a placeholder to the price input

↑ Back to top

NOTE:

The following customization is considered Developer level. If you are unfamiliar with code/templates and resolving potential conflicts, select a WooExpert or Developer for assistance. We are unable to provide support for customizations under our  Support Policy.

To add a placeholder attribute to the name your price <input> element you need to filter woocommerce_get_price_input by adding the following to your theme’s functions.php file.

/**
 * Add placeholder to NYP print input.
 * 
 * @param  array $args
 * @param  WC_Product $product
 * @return array - The modified input args.
 */
function wc_nyp_add_placeholder_to_nyp_input( $args, $product ) {
    $args['placeholder'] = esc_html__( 'Enter a price', 'your-textdomain' );
    return $args;
}
add_filter( 'wc_nyp_price_input_attributes', 'wc_nyp_add_placeholder_to_nyp_input', 10, 2 );

Are there query string or URL parameters available?

↑ Back to top

You can pre-fill the Name Your Price field or add a product directly to the cart using URL parameters. Use the following format:

https://yourdomain.com/checkout/?add-to-cart=PRODUCT_ID&nyp=PRICE
  • Replace PRODUCT_ID with the specific product’s ID.
  • Replace PRICE with the desired price (e.g., 1234.05).

An example of this would be:

https://yourdomain.com/checkout/?add-to-cart=244019&nyp=1234.05

The above example URL, when navigated to, would add the product with ID 244019 from your site to cart with the price value 1234.05.

This approach is useful for creating predefined checkout links tailored to your customers’ needs. Ensure the product ID matches your intended item for seamless operation.

How else can I customize Name Your Price?

↑ Back to top

Explore our Snippets Library for handy customizations tailored to the Name Your Price plugin. From altering labels to changing behavior, these snippets offer solutions to common design or functionality adjustments. Perfect for enhancing your store’s user experience while saving development time. Visit the library (here) for details!

I’m a non-profit or tax-exempt

↑ Back to top

If you’re tax-exempt or a nonprofit, VAT is automatically validated and exempted at checkout. For U.S. nonprofits, taxes can be refunded after purchase upon providing a valid tax-exempt certificate. Simply reply to your invoice email or contact the WooCommerce Happiness team to request this adjustment. Please note that subscription-related inquiries are best handled by the WooCommerce Happiness team, ensuring your questions are resolved promptly. For further details, visit WooCommerce’s official refund policy page.

Cancellation & Refunds

↑ Back to top

Our cancellation and refund policy follows WooCommerce‘s guidelines, as we are third-party developers in the WooCommerce Marketplace. Refunds may be available under specific conditions, such as product issues or unmet expectations, as outlined in the WooCommerce Refund Policy. Please review their policy for full details.

Requesting a Refund

↑ Back to top

To request a refund for an extension or theme subscription purchased from the WooCommerce.com Marketplace:

  • Go to your account dashboard at WooCommerce.com > Account > Orders.
  • Click the order number of the product you want to refund.
  • Click the vertical ellipsis icon (three dots) next to the order total column. This opens a prompt to request a refund.
    • Note: The refund option via the ellipsis icon will only appear within the 30-day refund window.
  • Click the link to Request a refund; a form will appear.
  • Select a refund reason from the drop-down menu and add your reason for the refund request.
  • Once complete, click the Request refund button.

I have questions & need support

↑ Back to top

Have a question before you buy? Please fill out this pre-sales form.

Already purchased and need some assistance? Get in touch the developer via the Help Desk.

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.