• Hello,

    First of all, thank you for this great plugin. It works like a charm and the documentation is very helpful.

    Only one thing I did not find : I try to turn some fields as ‘required’ in store details like ‘zip code’. Is it possible ? (screenshot : https://prnt.sc/ZT6S8iorfwhc)

    Best regards.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi there, thanks for reaching out!

    Of course, you can totally customize the appearance and the fields you show in the search results, please take a look at our wpsl_listing_template filter ??

    However, if all you want to do is modify the address format so that the zip code is not visible, you can also use the wpsl_address_formats filter to create a custom address format without zip code ??

    Regards,

    Thread Starter Reventlov

    (@reventlov)

    Hello,

    Thanks for your prompt answer.

    English is not my language and so, I probably did not explain correctly ??

    My request is not about template. It’s about fields in backend. I would like to make the zip code field mandatory like city field for instance.

    Here : ?https://prnt.sc/ZT6S8iorfwhc I want that it’s not possible to publish the store if zip code is not filled.

    Regards.

    Hi again,

    Oh, I understand now. Sorry, it was not your fault, I think you explained things pretty clearly but I misunderstood you.

    Well, actually the currently “required” fields are not required in the sense that you cannot publish a store without them. You can, indeed, publish a store without address, city or country, for example. These fields being empty will not prevent the store from being published, they will just not trigger the geolocation that will automatically find out the coordinates to place a pin in the map.

    And, since wpsl stores are just a custom post type, as far as I know it is not possible to make fields in custom post type “required” in the sense that you are looking for, sorry about that too.

    Regards,

    Thread Starter Reventlov

    (@reventlov)

    Hi,

    Ok I understand.

    So I added a custom field required in additional informations tab, like that :

    add_filter( 'wpsl_meta_box_fields', 'custom_meta_box_fields' );
    
    function custom_meta_box_fields( $meta_fields ) {
    ? ? $meta_fields[__( 'Additional Information', 'wpsl' )] = array(
    ? ? ? ? 'zip2' => array(
    ? ? ? ? ? ? 'label' => __( 'Zip code', 'wpsl' ),
    ? ? ? ? ? ? 'required' => true,
    ? ? ? ? ),
    );
    ? ? return $meta_fields;
    }

    It works but there is 2 zip fields now.

    Have a nice day.

    Well, in that sense you could also “merge” the required zipcode with the rest of the fields in the “Location” tab, and that would make the zip field appear with an asterisk, but it won’t prevent you from saving a store without zipcode either:

    add_filter( 'wpsl_meta_box_fields', 'custom_meta_box_fields' );
    function custom_meta_box_fields( $meta_fields ) {
        $meta_fields[ __( 'Location', 'wpsl' ) ]['zip'] =
    		array(
                'label' => __( 'Zip Code', 'wpsl' ),
                'required' => true
             
        );
        return $meta_fields;
    }
    
    add_filter( 'wpsl_frontend_meta_fields', 'custom_frontend_meta_fields' );
    function custom_frontend_meta_fields( $store_fields ) {
        $store_fields['wpsl_zip'] = array( 
            'name' => 'zip' 
        );
        return $store_fields;
    }

    Regards,

    Thread Starter Reventlov

    (@reventlov)

    Hi @farroyob ,

    Thank you ! I will try that. I take a break for couple of weeks ??

    Have a nice day.

    No problem, get back to us when you need it ??
    Regards,

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Turn some fields as ‘required’’ is closed to new replies.