WPSlash

WooFood Remove Checkout Fields and Rename on WooCommerce

Friday July 10, 2020

The following sample code snippet will help you remove all the Address fields from both Billing and Shipping Fields . This snippet will also rename the label name from First Name to Table Name


add_filter( 'woocommerce_default_address_fields' , 'wpslash_override_default_address_fields' );
function wpslash_override_default_address_fields( $address_fields ) {

     $address_fields['first_name']['label'] = __('Table Name', 'woocommerce');

	unset( $address_fields['postcode']);
	unset( $address_fields['city']);
	unset( $address_fields['state']);
	unset( $address_fields['company']);
	unset( $address_fields['address_1']);
	unset( $address_fields['address_2']);
	unset( $address_fields['country']);
	unset( $address_fields['postcode']);
       unset( $address_fields['last_name']);

    return $address_fields;
}

The following snippet will remove Email and Phone fields from Checkout

add_filter( 'woocommerce_billing_fields', 'wpslash_remove_billing_fields', 20, 1 );
function wpslash_remove_billing_fields($fields) {
    unset( $fields ['billing_email'] );
	unset( $fields ['billing_phone'] );
    return $fields;
}

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Articles

WooFood

How to Disable Coupons for Delivery Orders in WooCommerce

If you’re running a WooCommerce-powered restaurant or food delivery service, you might want to restrict certain coupon codes for delivery orders while keeping them valid for pickup orders. This ensures better control over discounts, prevents misuse, and improves your store’s pricing strategy. Why Restrict Coupons for Delivery Orders? Offering coupons is a great way to attract customers, but in food […]
June 20, 2023
WooFood

How to Automatically Re-Enable Disabled Products in WooFood Once a Day

If you’re running a WooCommerce-powered restaurant ordering system using WooFood, you might have products that automatically get disabled due to stock limits or availability settings. To ensure a smooth customer experience, you can automate the re-enabling process using a scheduled WordPress cron job. This method allows you to reset all product availability once a day, ensuring your menu stays active without manual intervention. Why […]
March 8, 2023
WooFood

How to Add Live Product Search to WooFood in WooCommerce

Enhancing the user experience of your WooCommerce-powered restaurant ordering system is crucial, and adding a live product search feature can significantly improve navigation. This feature allows customers to quickly find food items in your WooFood-powered menu without manually browsing through categories. In this article, we’ll show you how to integrate a live product search above the accordion menu in WooFood using a simple jQuery script and PHP snippet. […]
December 29, 2022