WooCommerce Name Your Price: Filter price input field to not show suggested/minimum prices
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
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