Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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