Home / Admin / Sending Form Fields as Smart Tags to Square
Duplicate Snippet

Embed Snippet on Your Site

Sending Form Fields as Smart Tags to Square

The snippet makes Smart Tags usable with Square payments. It allows you to include form fields to your Square payment description as Smart Tags.

<10
Code Preview
php
<?php
/**
 * Send the email address to Square
 *
 * @link   https://wpforms.com/developers/how-to-send-the-email-address-to-square-with-wpfoms/
 */
 
function wpf_dev_process_smart_tags_in_payment_description( $args, $process ) {
     
    if ( isset( $args[ 'note' ] ) ) {
        $note = apply_filters( 'wpforms_process_smart_tags', $args[ 'note' ], $process->form_data, $process->fields, 0 );
 
        // The maximum length for the Square notes field is 500 characters.
        $args[ 'note' ] = wp_html_excerpt( $note, 500 );
    }
 
    return $args;
     
}
add_filter( 'wpforms_square_process_get_payment_args_single', 'wpf_dev_process_smart_tags_in_payment_description', 10, 2 );

Comments

Add a Comment