Skip to content

Instantly share code, notes, and snippets.

@mindctrl
Created May 13, 2015 13:30
Show Gist options
  • Select an option

  • Save mindctrl/f7506b46e1b77511529d to your computer and use it in GitHub Desktop.

Select an option

Save mindctrl/f7506b46e1b77511529d to your computer and use it in GitHub Desktop.
Easy Digital Downloads - Remove billing details section on the checkout screen.
/**
* Removes the billing details section on the checkout screen.
*/
function jp_disable_billing_details() {
remove_action( 'edd_after_cc_fields', 'edd_default_cc_address_fields' );
}
add_action( 'init', 'jp_disable_billing_details' );
@Trumani

Trumani commented Sep 26, 2020

Copy link
Copy Markdown

Hi, can you please tell me what are the steps to insert this in wordpress?Where do I need to paste this code? I have a website, but I am fairly new to this and I don't want to mess up my work. Thank you very much, I await your reply.

Really late, but for those wondering, you can place it in your child theme's functions.php file.

@peeter2

peeter2 commented Oct 15, 2020

Copy link
Copy Markdown

Its no use. The billing input fields still seem to be required because when I click the Purchase button, it still tries to validate the fields and sees that they are empty. So it says:
Error: Please enter your zip / postal code
Error: Please enter your billing city
Error: Please select your billing country
Error: Please enter billing state / province

Is there a fix for this?

@Trumani

Trumani commented Oct 15, 2020

Copy link
Copy Markdown

Please try adding the following to functions.php

/* Make billing fields optional  */
function pw_edd_purchase_form_required_fields( $required_fields ) {

	unset( $required_fields['card_city'] );
	unset( $required_fields['card_zip'] );
	unset( $required_fields['billing_country'] );
	unset( $required_fields['card_state'] );

	return $required_fields;
}
add_filter( 'edd_purchase_form_required_fields', 'pw_edd_purchase_form_required_fields' )

@peeter2

peeter2 commented Oct 15, 2020

Copy link
Copy Markdown

Thank you!

@lassekh

lassekh commented Jan 22, 2021

Copy link
Copy Markdown

Does anyone know if removing this will cause problems with calculating taxes correct?

@Trumani

Trumani commented Jan 23, 2021

Copy link
Copy Markdown

I think it would cause a problem. How would it calculate taxes if your customers can't enter their billing address?

@gerardreches

Copy link
Copy Markdown

These fields are required to calculate EDD taxes and for some payment gateways, so they shouldn't be removed:

Important Notes:

There are a few checkout fields that cannot be modified by this extension:

  1. Billing Address fields. These are required by credit card payment gateways and by the EDD tax system, so these are not permitted to be modified.

  2. The Credit Card form used by payment gateways that process credit cards. Since it is vital these fields appear exactly as expected by EDD, these fields are not allowed to be modified.

Official source

@codebygina

codebygina commented Dec 6, 2021

Copy link
Copy Markdown

For EU VAT, the only thing needed is State. So ZIP, city, Province are just getting in seller's way for conversion...
I'll test just with the State field to see what happens. The idea is to first unset the required and then hide with CSS.

@codebygina

Copy link
Copy Markdown

This is the ideal checkout even with EU.
ideal

@dipakcg

dipakcg commented Nov 15, 2022

Copy link
Copy Markdown

Doesn't work with the latest Easy Digital Downloads version 3.1.0.2.

I can still see all the fields under Billing details section.

Screenshot  2022-11-10 230613 17051

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment