Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Add placeholder text to Name Your Price inputs
* Modify NYP price input's placeholder.
* @param array $attributes The array of attributes for the NYP div
* @param obj $product WC_Product The product object
* @param string $suffix - needed for grouped, composites, bundles, etc.
* @return string
* @return string - The modified input html.
function kia_custom_nyp_placeholder( $attributes, $product, $suffix ) {
$attributes['placeholder'] = __( 'Enter price here', 'your-text-domain' );
return $attributes;
add_filter( 'wc_nyp_price_input_attributes', 'kia_custom_nyp_placeholder', 10, 3 );
Copy link

captainhook commented Apr 5, 2021

This doesn't seem to work any more.

Copy link

helgatheviking commented Apr 5, 2021

@captainhook As of NYP 3, it's preferred to use the wc_nyp_price_input_attributes filter. See the updated gist. If you still have issues, please open a support ticket at

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment