Whatsapp link to chat - filled with frontend submission data

Support MB Frontend Submission Whatsapp link to chat - filled with frontend submission data

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #36666
    JoeJoe
    Participant

    Hi,

    i have a form with two fields (name and country). i want to achive the following : user puts in data, pushes the button and the data (name and country) gets send to a whatsapp chat

    this is the LINK format to start the whatsapp chat -> https://wa.me/49112112112?text='content of the two input fields'

    Any idea how to get this done ? How can I add the two input fields to the link ? I am a rather novice with metabox, using Oxygen Page builder.

    #36678
    Long NguyenLong Nguyen
    Moderator

    Hi Joe,

    I think you can try to use the filter hook rwmb_frontend_redirect or the action hook rwmb_frontend_after_process to redirect to Whatsapp social with the field value. For example

    add_filter( 'rwmb_frontend_redirect', function( $redirect, $config ) {
        // Make sure you work on the correct form.
        if ( 'my-id' !== $config['id'] ) {
            return $redirect;
        }
    
        // Get submitted data via $_POST.
        $value = empty( $_POST['field_id'] ) ? null : $_POST['field_id'];
        $redirect = 'https://wa.me/49112112112?text=' . $value;
        return $redirect;
    }, 10, 2 );

    Read more on the documentation https://docs.metabox.io/extensions/mb-frontend-submission/#general-hooks

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.