ASTRA_Ext_WooCommerce_Markup::label_fields_customization( array $fields )
Change order comments placeholder and label, and set billing phone number to not required.
Description
Parameters
- $fields
-
(array) (Required) checkout fields.
Return
(array)
Source
File: addons/woocommerce/classes/class-astra-ext-woocommerce-markup.php
public function label_fields_customization( $fields ) {
if ( is_checkout() && ! is_wc_endpoint_url( 'order-received' ) && 'modern' === astra_get_option( 'woo-input-style-type' ) ) {
$field_types = array(
'billing',
'shipping',
'account',
'order',
);
foreach ( $field_types as $type ) {
if ( isset( $fields[ $type ] ) && is_array( $fields[ $type ] ) ) {
foreach ( $fields[ $type ] as $key => $field ) {
// Add label as placeholder if the placeholder value is empty.
if ( empty( $fields[ $type ][ $key ]['placeholder'] ) ) {
$fields[ $type ][ $key ]['placeholder'] = $fields[ $type ][ $key ]['label'];
}
// Remove screen-reader-text class from labels.
if ( isset( $fields[ $type ][ $key ]['label_class'] ) ) {
$fields[ $type ][ $key ]['label_class'] = array_diff( $fields[ $type ][ $key ]['label_class'], array( 'screen-reader-text' ) );
}
}
}
}
}
return $fields;
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 3.9.0 | Introduced. |