Certain fields can be made optional on the checkout form. Here's a list of all the fields that can be made optional:
- First Name
- Last Name
- Phone Number
- Password
- Billing Address
- Billing City
- Billing State
- Billing Zip Code
- Billing Country
- Shipping Address
- Shipping City
- Shipping State
- Shipping Zip Code
- Shipping Country
NOTE: Keep in mind the requirements of your payment method when making a field optional. For example, if you choose to make the billing zip code optional, you'll need to configure the settings for your payment provider accordingly.
In order to demonstrate the options available for including these fields on the checkout form, we'll use the Phone Number field as an example.
As an example, here's how the phone number can be added to the checkout form
To include the phone number field on a checkout form do the following:
[MM_Form_Field type='input' name='phone']
When you include it like this, the customer will be required to enter in their phone number.
Optionally collect phone number
If you want to collect the customer's phone number but make it optional you can use the ‘isRequired' attribute as follows:
[MM_Form_Field type='input' name='phone' isRequired='false']
When you include it like this, the customer can optionally enter in their phone number.
Hide phone number field
If you want to remove the phone number from the checkout page, do not delete the SmartTag™ from the form, instead do this:
[MM_Form_Field type='hidden' name='phone' isRequired='false']
When the phone number field is included like this, it won't show up on the checkout form.
Stop empty spaces from being created when hiding a field
By default, WordPress automatically converts double line-breaks in text into HTML paragraph tags (<p>…</p>). To keep this from happening, refer to and follow the instructions outlined in the article Extra Lines Are Being Added to the Checkout Page.
Here is another trick to keep the empty spaces from appearing
If you have tried the article above and are still getting empty spaces, or you simply do not want another plugin to worry about, then you would need to place one SmartTag™ immediately after another SmartTag™ on the same line, as outlined below:
<p class="mm-formField">
<label>Password:</label>
[MM_Form_Field type='input' name='password'][MM_Form_Field type='hidden' name='phone' isRequired='false']
</p>
When the phone number field is included like this, it won't show up on the checkout form, and you shouldn't get any blank or empty spaces below the password field.
If you want more control over the appearance of the page, you can try customizing the MM stylesheet, or replacing it with one of your own: