I wonder if can set a default value for an attribute field?
I know the placeholder field, but if the user starts writing in the field, the placeholder disappears (which is the correct behavior).
I want to make a “WhatsApp” attribute, which has the default WhatsApp address “https://wa.me/” as Value, so the User only have to add his number at the end.
The same with the “Homepage” attribute and “https://” as default value.
I allready tried to use some snippets, but it didn’t work out.
add_filter(
'hivepress/v1/models/listing/attributes',
function( $attributes ) {
if ( isset( $attributes['whatsapp'] ) ) {
$attributes['whatsapp']['edit_field']['value'] = "Test";
$attributes['whatsapp']['edit_field']['_value'] = "Test";
$attributes['whatsapp']['edit_field']['placeholder'] = "Test";
}
return $attributes;
},
1000
);