Skip to content

Instantly share code, notes, and snippets.

@slavapas
slavapas / functions.php
Created January 25, 2022 21:06
Woocommerce unify Name and Surname in one line
add_filter( 'woocommerce_billing_fields' , 'ced_remove_billing_fields' );
function ced_remove_billing_fields( $fields ) {
unset($fields['billing_last_name']);
return $fields;
}
add_filter( 'woocommerce_checkout_fields' , 'ced_rename_checkout_fields' );
// Change placeholder and label text
function ced_rename_checkout_fields( $fields ) {
$fields['billing']['billing_first_name']['placeholder'] = 'Name';
@slavapas
slavapas / functions.php
Created January 28, 2022 14:52
WooCommerce Checkout Page change Label Text
function add_wc_custom_fields($fields) {
global $woocommerce;
$countries_obj = new WC_Countries();
$countries = $countries_obj->__get('countries');
$fields['billing']['billing_first_name'] = array(
'label' => '',
'placeholder' => _x('First Name*', 'placeholder', 'woocommerce'),
'required' => true,
'class' => array( 'form-row-first' ),