How to put Woocommerce in “Request a Quote” mode without a plugin?

In this post I’ll show you how to put your Woocommerce shop in “Request a quote” mode without any fancy plugin. It’s going to take only a couple of small code snippets and a couple of lines of CSS code. So, let’s dive in.

In order to accomplish this just grab this snippets here below and add these to your site. If you don’t know where to add the code snippet displayed here below, then add it either to your child theme’s functions.php file or better yet, use a snippet manager like Code Snippets

Video: How to put Woocommerce in “Request a Quote” mode without a plugin?

Step 1: Hide Woocommerce Prices on the Shop and Category Pages

In order to put your site in “Request a quote” mode we need to hide prices. This snippet here should do the trick.

// Hide Woocommerce Prices on the Shop and Category Pages
add_filter( 'woocommerce_get_price_html', 'woocommerce_remove_price');
function woocommerce_remove_price($price){     
     return ;
}

Step 2: Rename “Add to cart” and “Place order” button texts

Since I want my customers to see “Add to enquiry” instead of “Add to cart” and “Request a quote” instead of “Place order” I us this snippet.

// Rename Woocommerce "Add to cart" and "Place order" text
add_filter('gettext', 'translate_strings');
add_filter('ngettext', 'translate_strings');
function translate_strings($translated) {
	$translated = str_ireplace('Add to cart', 'Add to enquiry', $translated);
  $translated = str_ireplace('Place order', 'Request a quote', $translated);
return $translated;
}

Step 3: Skip Woocommerce cart page and redirect it to the Checkout page

With this “Request a quote” solution my Woocommerce cart page becomes obsolete and therefore I’ll redirect cart page to the checkout page.

// Skip Woocommerce cart page and redirect to checkout
add_action('template_redirect', 'wpsh_skip_cart');
function wpsh_skip_cart() {
    // If is cart page, redirect checkout.
    if( is_cart() )
        wp_redirect( WC()->cart->get_checkout_url() );
}

Step 4: Disable all Woocommerce payment gateways

I also have no need for payment gateways, so I’ll deactivate all of those in a way that order can still be placed.

// Disable all Woocommerce payment gateways
add_filter( 'woocommerce_cart_needs_payment', '__return_false' );

Step 5: Remove un-necessary Woocommerce checkout fields

By default Woocommerce asks a bunch of information on a checkout page, but I’ll remove those fields I don’t need. In this case I’ll remove address, city, state and postcode fields. You can tweak this code here below as you like and remove only those fields you need.

// Remove Woocommerce checkout fields
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );

function custom_override_checkout_fields( $fields ) {
   // unset($fields['billing']['billing_first_name']); // Billing First name
   // unset($fields['billing']['billing_last_name']); // Billing Last name
   // unset($fields['billing']['billing_company']); // Billing company
    unset($fields['billing']['billing_address_1']); // Billing Address 1
    unset($fields['billing']['billing_address_2']); // Billing Address 2
    unset($fields['billing']['billing_city']); // Billing city
    unset($fields['billing']['billing_postcode']); // Billing postcode
   // unset($fields['billing']['billing_country']); // Billing country
    unset($fields['billing']['billing_state']); // Billing state
   // unset($fields['billing']['billing_phone']); // Billing phone
   // unset($fields['billing']['billing_email']); // Billing email
   // unset($fields['order']['order_comments']); // Order comments
     return $fields;
}

Step 6: Remove “Ship to a different address” section

I need only billing section to be activated and there’s no need for shipping fields. So, I’ll go to Woocommerce >> Settings >> Shipping >> Shipping options and activate “Force shipping to the customer billing address.”

How to put Woocommerce in "Request a Quote" mode without a plugin?

Step 6: Add “Remove item” option to Woocommerce checkout page

Since I deactivated my cart page and redirected it to the checkout page, I need an option that allows my customers to remove items from the Woocommerce checkout page. This snippet helps me out.

// Add "Remove item" option to checkout
add_filter( 'woocommerce_cart_item_name', 'wpsh_checkout_remove_item', 10, 3 );
function wpsh_checkout_remove_item( $product_name, $cart_item, $cart_item_key ) {
if ( is_checkout() ) {
    $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
    $product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );

    $remove_link = apply_filters( 'woocommerce_cart_item_remove_link', sprintf(
        '<a href="%s" class="remove" aria-label="%s" data-product_id="%s" data-product_sku="%s">×</a>',
        esc_url( WC()->cart->get_remove_url( $cart_item_key ) ),
        __( 'Remove this item', 'woocommerce' ),
        esc_attr( $product_id ),
        esc_attr( $_product->get_sku() )
    ), $cart_item_key );

    return '<span>' . $remove_link . '</span> <span>' . $product_name . '</span>';
}
return $product_name;
}

Step 7: Redirect empty Woocommerce cart and checkout page to the shop page

At this point there’s a small issue. That is, since I removed my cart page then removing all items from checkout page will redirect us to the cart page. This one again redirects us to the checkout page, and we’ll end up with “Too many redirects” error. To fix it, we’ll redirect empty cart anc checkout page to the main shop page.

// Redirect empty Woocommerce cart and checkout page to the shop page
add_action("template_redirect", 'wpsh_redirect_empty_cart');
function wpsh_redirect_empty_cart(){
    global $woocommerce;
    if( is_cart() && WC()->cart->cart_contents_count == 0){
        wp_safe_redirect( get_permalink( woocommerce_get_page_id( 'shop' ) ) );
    }
}

Step 8: Add custom CSS

With the help of this custom CSS here below you’ll remove shipping and pricing info from the checkout page and thank you page

.woocommerce-shipping-totals.shipping, th.product-total, tr.order-total, tr.cart-subtotal, td.product-total, .order_details tfoot, .woocommerce-Price-amount {
	display: none;
}
#order_review table.shop_table tr>*:first-child {
    width: 100% !important;
}

If you’re using a Blocksy theme then additionally add this part here below. It’ll remove some information from the side cart.

#woo-cart-panel .woocommerce-mini-cart__total, .multiply-symbol {
	display: none;
}
.product_list_widget .quantity[data-type=type-1] , .product_list_widget .quantity[data-type=type-2] {
    display: none;
}
/* This hides the price from the sidecart */
.product_list_widget .ct-product-actions {
    display: none;
}

Step 9: Disable Woocommerce coupons

Go to Woocommerce >> Settings and uncheck “Enable the use of coupon codes”

Here are some of my favorite WordPress tools

Thanks for reading this article! I hope it's been useful as you work on your own websites and e-commerce sites. I wanted to share some tools I use as a WordPress developer, and I think you'll find them helpful too.

Just so you know, these are affiliate links. If you decide to use any of them, I'll earn a commission. This helps me create tutorials and YouTube videos. But honestly, I genuinely use and recommend these tools to my friends and family as well. Your support keeps me creating content that benefits everyone.

Themes: Over the past few years, I've consistently relied on two primary themes for all sorts of projects: the Blocksy theme and the Kadence Theme. If you explore this website and my YouTube channel, you'll come across numerous tutorials that delve into these themes. If you're interested in obtaining a 10% discount for both of these themes, then:

Code Snippets Manager: WPCodeBox allows you to add code snippets to your site. Not only that, but it also provides you with the capability to construct and oversee your WordPress Code Snippets library right in the cloud. You can grab it with the 20% discount here (SAVE 20% Coupon: WPSH20).

Contact forms: There are hundreds of contact forms out there but Fluent Forms is the one I like the most. If you need a 20% discount then use this link (save 20% coupon is WPSH20).

Gutenberg add-ons: If I need a good Gutenberg blocks add-on then Kadence Blocks is the one I have used the most. You’ll get a 10% discount with the coupon SIMPLEHACKS here.

Website migration: While building a website you probably need a good plugin that can help you with the migration, backups, restoration, and staging sites. Well, WpVivid is the one I have used for the last couple of years. If you use this link along with the WPSH20 coupon you’ll get a 20% discount.

Woocommerce extensions: There are a bunch of Woocommerce extensions that I like but the one that stands out is Advanced Dynamic Pricing. Once again, you’ll get a 20% discount if you use this link here (save 20% coupon is WPSH20)

Web Hosting: If you would like to have a really fast and easy-to-use managed cloud hosting, then I recommend Verpex Hosting (see my review here). By the way, this site is hosted in Verpex.)

To see all my most up-to-date recommendations, check out this resource that I made for you!

Do you want to thank me and buy me a beer?

Every donation is entirely welcome but NEVER required. Enjoy my work for free but if you would like to thank me and buy me a beer or two then you can use this form here below.

Donation Form (#2)

Janek T.
Janek T.

Improve this text: {CLIPBOARD}

- I have been passionate about Wordpress since 2011, creating websites and sharing valuable tips on using Wordpress and Woocommerce on my site.
- Be the first to receive notifications about new tutorials by subscribing to my Youtube channel .
- Follow me on Twitter here

Articles: 105