Remove cart + checkout, add class, change label woocomerce (ok)

<?php  
	// link: https://gist.github.com/metinsaylan/344384f5eb2f4881734e	
	// link: https://rudrastyh.com/woocommerce/custom-checkout-validation.html
	
	add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields');
	function custom_override_checkout_fields( $fields ) {
		unset($fields['billing']['billing_last_name']);
		unset($fields['billing']['billing_country']);
		unset($fields['billing']['billing_company']);
		unset($fields['billing']['billing_postcode']);
		unset($fields['billing']['billing_address_2']);
		unset($fields['billing']['billing_city']);
		return $fields;
	}
	// https://businessbloomer.com/woocommerce-how-to-hide-shipping-calculator-fields-cart/
	// 1 Disable State
	add_filter( 'woocommerce_shipping_calculator_enable_state', '__return_false' );
	 
	// 2 Disable City
	add_filter( 'woocommerce_shipping_calculator_enable_city', '__return_false' );
	 
	// // 3 Disable Postcode
	add_filter( 'woocommerce_shipping_calculator_enable_postcode', '__return_false' );
	add_filter( 'woocommerce_shipping_calculator_enable_postcode', '__return_false' );
	function disable_shipping_calc_on_cart( $show_shipping ) {
			
	    if( is_cart() ) {
	        return false;
	    }
	    return $show_shipping;
	}
	add_filter( 'woocommerce_cart_ready_to_calc_shipping', 'disable_shipping_calc_on_cart', 99 );
?>

https://gist.github.com/cryptexvinci/acfffd317ea6593d85f87191f92528c6

add_filter('woocommerce_checkout_fields', 'custom_override_checkout_fields');
function custom_override_checkout_fields($fields) {
  unset($fields['billing']['billing_last_name']);
  unset($fields['billing']['billing_country']);
  unset($fields['billing']['billing_company']);
  unset($fields['billing']['billing_postcode']);
  unset($fields['billing']['billing_address_2']);
  unset($fields['billing']['billing_city']);
  unset($fields['billing']['billing_state']);
  return $fields;
}
add_filter('woocommerce_default_address_fields', 'override_default_address_fields');
function override_default_address_fields($address_fields) {
  // @ for city
  $address_fields['city']['class'] = array('form-row-first');
  $address_fields['city']['label'] = __('Province', 'woocommerce');
  // @ for postcode
  $address_fields['first_name']['label'] = __('Full name', 'woocommerce');
  return $address_fields;
}

Last updated