0

I have a custom function, which was working properly before switching servers, after changing servers there is an issue.

    add_filter( ‘woocommerce_billing_fields’, ‘force_wc_phone_field’);
function force_wc_phone_field( $fields ) {
$fields[‘billing_phone’][‘required’] = true;
return $fields;
}
add_filter('woocommerce_billing_fields', 'force_billing_fields', 1000, 1);
function force_billing_fields($fields) {
  $fields['billing_first_name']['required'] = true;
  $fields['billing_last_name']['required'] = true;
  $fields['billing_address_1']['required'] = true;
  $fields['billing_city']['required'] = true;
  $fields['billing_postcode']['required'] = true;
  $fields['billing_country']['required'] = true;
  $fields['billing_state']['required'] = true;
  $fields['billing_email']['required'] = true;
  $fields['billing_phone']['required'] = true;

  return $fields;
}

Here is the error

Warning: Use of undefined constant ‘woocommerce_billing_fields’ - assumed '‘woocommerce_billing_fields’' (this will throw an Error in a future version of PHP) in /wp-content/themes/flatsome-child/functions.php on line 258

Warning: Use of undefined constant ‘force_wc_phone_field’ - assumed '‘force_wc_phone_field’' (this will throw an Error in a future version of PHP) in /wp-content/themes/flatsome-child/functions.php on line 258
phpnewbie
  • 3
  • 3
  • wrong quotes... ‘woocommerce_billing_fields’ you need single apostrpohe or double quote: 'woocommerce_billing_fields' or "woocommerce_billing_fields" – Honk der Hase Nov 20 '21 at 09:54

0 Answers0