Support » Plugin: WooCommerce » Remove Add to Cart Button on Condition

  • Resolved webtinker


    Working on WooCommerce product with Gravity Forms. In a product we have a multi-page form where we provided save and continue later link. This functionality is added to comeback and finish the form later at the user’s convenience.

    Everything works fine, except but when someone saves the form, i want to hide the Submit | Add to Cart button removed or hidden with jQuery or custom function.

    This is the page i need to help with:

    Currently the save and continue later link is outputting the following code:
    <a href="javascript:void(0);" id="gform_save_39_link" class="gform_save_link" tabindex="10" onclick="if(window[&quot;gf_submitting_39&quot;]){return false;} window[&quot;gf_submitting_39&quot;]=true; jQuery(&quot;#gform_save_39&quot;).val(1); jQuery(&quot;#gform_39&quot;).trigger(&quot;submit&quot;,[true]);" onkeypress="if( event.keyCode == 13 ){ if(window[&quot;gf_submitting_39&quot;]){return false;} window[&quot;gf_submitting_39&quot;]=true; jQuery(&quot;#gform_save_39&quot;).val(1); jQuery(&quot;#gform_39&quot;).trigger(&quot;submit&quot;,[true]); }">Save and Continue Later</a>

    After the Save and Continue Later link clicked, the page/form updates with a email input field for the user to receive the link to comeback.

    And the button’s ID is gform_submit_button_39, which i want to hide on Save and Continue Click event.

    Thanks in advance.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Con a11n


    Automattic Happiness Engineer

    Hi Amarnath,

    I figure code support for such a customisation is beyond of what we can do here. You will probably have to find coding support elsewhere (of course anybody after me may prove me wrong).

    In the meantime here is a super simple jsfiddle using a basic Javascript condition statement to hide and show an element:

    Kind regards,

    Thread Starter webtinker


    @conschneider thank you very much for the jsfiddle.

    Thread Starter webtinker


    @conschneider apparently achieved finally with a simple jQuery call when a save_form_message ID is true, disable submit button.

    <script type="text/javascript">
        if (jQuery(".form_saved_message").length > 0) {

    Thanks once again for your advice, which lead me to find this snippet and fix the issue.

    Plugin Support Con a11n


    Automattic Happiness Engineer

    Hey again,

    Glad to hear that helped and great to see you shared your solution.
    Thank you for that.

    • This reply was modified 3 years, 3 months ago by Con a11n.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove Add to Cart Button on Condition’ is closed to new replies.