Last active
April 5, 2021 17:28
-
-
Save helgatheviking/e1326e2047ed621158f86c1d4747e9bc to your computer and use it in GitHub Desktop.
Add placeholder text to Name Your Price inputs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 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
This doesn't seem to work any more.