Wordpress

Remove the Billing Details from WooCommerce Checkout

By default, WooCommerce will add a form to the client to enter his billing details such as name, company, address, city postcode, state, phone & country. For some web store owner, you may not need of them, especially if you only sell digital or virtual products. We just need customers to make payment through PayPal in the simplest way possible.

Unfortunately, there are no settings in WooCommerce to disable these fields. The only way to do it is by editing theme’s “functions.php” file.

What you need to do is add the following codes in your theme’s “functions.php” file but remember to remove the line where you need details from your customers.

add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
 
function custom_override_checkout_fields( $fields ) {
    unset($fields['billing']['billing_first_name']);
    unset($fields['billing']['billing_last_name']);
    unset($fields['billing']['billing_company']);
    unset($fields['billing']['billing_email']);
    unset($fields['billing']['billing_address_1']);
    unset($fields['billing']['billing_address_2']);
    unset($fields['billing']['billing_city']);
    unset($fields['billing']['billing_postcode']);
    unset($fields['billing']['billing_country']);
    unset($fields['billing']['billing_state']);
    unset($fields['billing']['billing_phone']);
    unset($fields['order']['order_comments']);
    return $fields;
}

Implementing EU User Consent Policy in Thesis 2+ WordPress Theme

As mentioned in Implementing EU User Consent Policy for Google AdSense post, AdSense user has to notify EU user on the use of cookies. We already have the code to implement this but how to implement if you are using WordPress Thesis 2+ WordPress theme?

In order to implement EU User Consent Policy in Thesis 2+ WordPress Theme, we have to add a Custom Hook Code in either /wp-content/thesis/master.php or /wp-content/thesis/skins/skin-name/custom.php file.

Copy the following code in the custom file. Bear in mind that this code will only work if you are using Cloudflare service for your domain & enable IP Geolocation in the specific domain.

/* EU User Consent Policy */
function eu_user() {
	$country_code = $_SERVER["HTTP_CF_IPCOUNTRY"];

	$europe = array('EU', 'AT', 'BE', 'BG', 'CY', 'HR', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'GB', 'AL', 'MK', 'ME', 'RS', 'TR', 'BA', 'XK');

	if(in_array($country_code, $europe)) { ?>
		<!-- Begin Cookie Consent plugin by Silktide - http://silktide.com/cookieconsent -->
		<script type="text/javascript">
		 window.cookieconsent_options = {"message":"This website uses cookies to ensure you get the best experience on our website","dismiss":"Got it!","learnMore":"More info","link":null,"theme":"dark-bottom"};
		</script>
 
		<script type="text/javascript" src="//s3.amazonaws.com/cc.silktide.com/cookieconsent.latest.min.js"></script>
		<!-- End Cookie Consent plugin -->
	<?php
	}
}
add_action('hook_before_html', 'eu_user');