Home / Admin / How to Add an Empty Dropdown to Dropdown Items
Duplicate Snippet

Embed Snippet on Your Site

How to Add an Empty Dropdown to Dropdown Items

This snippet maintains a clean "--Select--" option without the zero price display when using the Dropdown Items payment field.

<10
Code Preview
php
<?php
/**
* Empty dropdown item without the price showing for payment dropdown selection.
*
* @link https://wpforms.com/developers/how-to-add-an-empty-dropdown-to-dropdown-items/
*/
function wpf_dev_empty_dropdown_item() {
    ?>
    <script type="text/javascript">
    jQuery('.wpforms-payment-price option[data-amount="0.00"]').text('--Select--');
    </script>
    <?php
}
add_action('wpforms_wp_footer_end', 'wpf_dev_empty_dropdown_item', 30);

Comments

Add a Comment