Description
// Add To Cart Buttons On Archives
add_filter( 'woocommerce_product_add_to_cart_text', function( $text, $product ) {
if( $product->is_type( 'variable' ) ) { return $text; }
$price_numeric = floatval( $product->get_price() );
return $price_numeric > 0 ? $text : 'Request Quote';
}, 10, 2 );
// Eliminate Variation Price Range
add_filter( 'woocommerce_variable_price_html', function( $price, $product ) {
$price_numeric = floatval( $product->get_price() );
return $price_numeric > 0 ? $price : 'Request Quote';
}, 10, 2 );
// Single Product Price Display
add_filter( 'woocommerce_get_price_html', function( $price, $product ) {
$price_numeric = floatval( $product->get_price() );
return $price_numeric > 0 ? $price : '';
}, 10, 2 );
// Add To Cart Buttons On Product Pages
add_filter( 'woocommerce_product_single_add_to_cart_text', function( $text, $product ) {
if( $product->is_type( 'variable' ) ) { return 'Select'; }
$price = $product->get_price();
return floatval( $price ) > 0 ? $text : 'Request Quote';
}, 10, 2 );
// Order Item Table Price
add_filter( 'woocommerce_cart_item_price', function( $price, $cart_item, $cart_item_key ) {
$price_numeric = floatval( $cart_item['line_subtotal'] );
return $price_numeric > 0 ? $price : 'Quote Request';
}, 10, 3 );
// Order Item Table Subtotal
add_filter( 'woocommerce_cart_item_subtotal', function( $price, $cart_item, $cart_item_key ) {
$price_numeric = floatval( $cart_item['line_subtotal'] );
return $price_numeric > 0 ? $price : 'Quote Request';
}, 10, 3 );
// Cart Proceed-To-Checkout Button
remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 );
add_action( 'woocommerce_proceed_to_checkout', function() {
printf(
'<a href="%s" class="checkout-button button alt wc-forward">%s</a>',
wc_get_checkout_url(),
__( 'Continue', 'woocommerce' )
);
}, 20 );
// Place Order Button
add_filter( 'woocommerce_order_button_text', function( $text ) {
$price_numeric = floatval( WC()->cart->cart_contents_total );
return $price_numeric > 0 ? $text : 'Request Quote';
} );
Support
Using our Google upload form:
- Describe the issue and what you’ve observed.
- Describe your expected outcome(s).
- List steps to reproduce the issue.
- Optionally attach screen-shot images or a video.
Credits
We code all of our code snippets directly. Our clients provide most of the ideas and demand for the functionality provided by our code snippets.
There are several sources one can find on Google for code that has inspired or contributed to this open-source library. Here’s some main ones:
License & Disclaimer
All code snippets are licensed GPLv2 (or later) matching WordPress licensing.
Disclaimer of warranty:
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.