• Resolved macgyver97

    (@macgyver97)


    Hi,

    Looking for a way to refresh/clear the text box fields when using this plugin and adding an item to the cart.

    Currently, when you choose Add to Cart, the browser remains on the current product, a message appears about the item being added to the cart, however, the text field keeps the previously entered information.

    Is there a way to clear that field so a user can add a new product?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter macgyver97

    (@macgyver97)

    Possible solution:

    
    jQuery(document).ready(function($){
      $("form").submit(function(){
        $('input').val(''); } 
    		);
    });
    
    • This reply was modified 4 years, 8 months ago by macgyver97.
    • This reply was modified 4 years, 8 months ago by macgyver97.
    • This reply was modified 4 years, 8 months ago by macgyver97.
    • This reply was modified 4 years, 8 months ago by macgyver97.
    Plugin Author ThemeHigh

    (@themehigh)

    Please try to add the below code in your theme’s functions.php file.

    add_action('wp_footer', 'thwepo_clear_wepo_val', 99);
    function thwepo_clear_wepo_val(){
     if(is_product()){
     ?>
     <script type="text/javascript">
       (function($){
         $(window).on('load', function(){
           $('.thwepof-input-field').val('');
         });
       })(jQuery, window, document)
     </script>
     <?php
     }
    }

    We hope this will help.

    Thank you!

    Thread Starter macgyver97

    (@macgyver97)

    Thank you — this worked perfectly!

    Plugin Author ThemeHigh

    (@themehigh)

    Great!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Clearing text boxes when adding to cart’ is closed to new replies.