Skip to content

Instantly share code, notes, and snippets.

@helgatheviking
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save helgatheviking/1baef0f02a8dc0b24239 to your computer and use it in GitHub Desktop.
Save helgatheviking/1baef0f02a8dc0b24239 to your computer and use it in GitHub Desktop.
WooCommerce Name Your Price: Filter price input field to not show suggested/minimum prices
function woocommerce_nyp_price_input_no_price( $html, $product_id, $prefix ) {
// only get the posted price (price submitted on add-to-cart) otherwise NULL
$price = WC_Name_Your_Price_Helpers::get_posted_price( $product_id, $prefix );
return sprintf( '<input id="nyp%s" name="nyp%s" type="text" value="%s" size="6" title="nyp" class="input-text amount nyp-input text" />', $prefix, $prefix, WC_Name_Your_Price_Helpers::format_price( $price ) );
;
}
add_filter( 'woocommerce_get_price_input', 'woocommerce_nyp_price_input_no_price', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment