Support » Plugin: WP Store Locator » Form to add Store from front-end

  • Hi there,

    We’re looking to have a private area in the site for the Store owners to submit a petition on showcasing their store in the map.

    Is is possible to have the form displayed in the front end?
    Otherwise, would it be possible to use a query to save/add a Store post type? i.e. with all the custom field names, etc?

    What I’m thinking is adding those as Draft so only when approved/published by the Admin those appear in the map.

    Is this possible? What do you recommend?

    Thanks!
    Diana.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Tijmen Smit

    (@tijmensmit)

    What you want is possible, but it does require a bit of custom code.

    You could use a form plugin like Ninja Forms of Gravity Forms and then use a filter from those plugins that runs after the form is submitted to insert the form data as a store location.

    This will have to be custom coded, and I unfortunately don’t have any code snippets that I can share showing how to do this.

    Any form plugin that has a filter that runs after it’s submitted should be fine, since it allows you to intercept the submitted data.

    If you want to go down the road of custom coding it, then let me know, and I can point you in the right direction when it comes to creating the location.

    • This reply was modified 4 years, 9 months ago by Tijmen Smit.
    Thread Starter dianahellonextstep

    (@dianahellonextstep)

    Thanks for answering Tijmen,
    I’ll definitely aim to create custom code to store the new store location into the database.
    I would only need the field names, types etc documentation from you to ensure I’m saving everything correctly.

    Thanks!
    Diana.

    Plugin Author Tijmen Smit

    (@tijmensmit)

    Sorry for the late response.

    You need to create a new store location with wp_insert_post ( for the wpsl_stores custom post type ), this will return an ID which you need to use with update_post_meta.

    The meta fields itself you can get from this function.

    If no coordinates are provided, then you can grab them by passing the address to this function which you then save as the wpsl_lat and wpsl_lng key in the meta field for the location.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Form to add Store from front-end’ is closed to new replies.