Skip to content

Instantly share code, notes, and snippets.

Embed
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 );
@captainhook
Copy link

captainhook commented Apr 5, 2021

This doesn't seem to work any more.

@helgatheviking
Copy link
Author

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 https://woocommerce.com/my-account/create-a-ticket/

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