Advertisement
daymobrew

WooCommerce Checkout - only require email address

Mar 16th, 2015
720
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.19 KB | None | 0 0
  1. <?php
  2. /*
  3. Plugin Name: WooCommerce - Minimal Required Fields
  4. Plugin URI: http://www.damiencarbery.com
  5. Description: Experiment with the minimal number of fields required to complete PayPal payment.
  6. Author: Damien Carbery
  7. Version: 0.1
  8.  
  9. $Id: $
  10. */
  11.  
  12.  
  13. // See: http://docs.woothemes.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/
  14. add_filter( 'woocommerce_checkout_fields' , 'wmrf_remove_checkout_fields' );
  15.  
  16. // Our hooked in function - $fields is passed via the filter!
  17. function wmrf_remove_checkout_fields( $fields ) {
  18.     // Remove all billing fields except the email field.
  19.     unset($fields['billing']['billing_first_name']);
  20.     unset($fields['billing']['billing_last_name']);
  21.     unset($fields['billing']['billing_company']);
  22.     unset($fields['billing']['billing_address_1']);
  23.     unset($fields['billing']['billing_address_2']);
  24.     unset($fields['billing']['billing_city']);
  25.     unset($fields['billing']['billing_postcode']);
  26.     unset($fields['billing']['billing_country']);
  27.     unset($fields['billing']['billing_state']);
  28.     unset($fields['billing']['billing_phone']);
  29.    
  30.     unset($fields['order']['order_comments']);
  31.    
  32.     return $fields;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement