Banner Logo

Be a part of the family: Connect, Receive Support,
Contribute, and Reap Abundant Rewards!

Automatic check input for Virtual & Downloadable product

WCMp Core

Resolved
Viewing 3 reply threads
  • Author
    Posts
    • #124480
      MaxenceTP
      Participant

      Hello!

      How to automatically check these 2 inputs (https://prnt.sc/19grbwe) on the add-product page ?

      I have the following code :

      <script>
      	document.getElementById('_virtual').checked = true;
      	document.getElementById('_downloadable').checked = true;
      </script>
      Copy

      Just need to know which action/filter to use in my child theme to run the code which will check the inputs.

    • #124501

      Hi,
      Please add this code in the function.php of the current active theme :

      add_action( 'wcmp_add_product_form_end', 'wcmp_add_custom_js' );
      function wcmp_add_custom_js(){?>
          <script>
              document.getElementById('_virtual').checked = true;
              document.getElementById('_downloadable').checked = true;
          </script>
      <?php
      }
      Copy

      Regards,

    • #124517
      MaxenceTP
      Participant

      Thanks, that works!

    • #124542

      You are welcome @Maxence . We are happy to help.

Viewing 3 reply threads

The topic ‘Automatic check input for Virtual & Downloadable product’ is closed to new replies.