Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying WooCommerce Cookbook
  • Table Of Contents Toc
  • Feedback & Rating feedback
WooCommerce Cookbook

WooCommerce Cookbook

By : Rauland
3.4 (12)
close
close
WooCommerce Cookbook

WooCommerce Cookbook

3.4 (12)
By: Rauland

Overview of this book

If you have ever built or managed a WordPress site and want to add e-commerce functionality into your site, WooCommerce and this book are perfect for you. Learning how to use WooCommerce through this series of recipes will give you a solid platform to add any future e-commerce needs.
Table of Contents (12 chapters)
close
close
11
Index

Hiding all checkout fields for virtual products


WooCommerce is pretty smart. If you only have virtual products such as memberships or downloadable products in the cart, WooCommerce won't ask for any shipping information. But some people want to take this a step further. They don't want all of the billing details—they only want the bare minimum information.

WooCommerce doesn't automatically remove these fields because some payment gateways require more billing information. If your payment gateway doesn't require billing details, then you could do this and make the checkout process a bit smoother. The best way to find out if your payment gateway allows this is to try the following code snippet and do a test purchase.

How to do it…

We'll have to add some code to our functions.php file in our theme or create a custom WooCommerce plugin.

  1. At the bottom of your theme's functions.php file, add the following code to change the checkout fields that are displayed to the user:

    // Remove unnecessary checkout...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech
bookmark search playlist download font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete