All Collections
Zapiet - Pickup + Delivery
Troubleshooting
Locking the checkout button until the widget has loaded
Locking the checkout button until the widget has loaded
Jelizaveta avatar
Written by Jelizaveta
Updated over a week ago

If you live in a region with poor bandwidth, your customers may have issues checking out before our widget has fully loaded and then skip adding relevant date and time details. In this case, you can disable the checkout button until our widget has fully loaded.



Lock the checkout button

  1. In theme library, select the theme and click Edit code.

  2. In Layout section, click theme.liquid file.

  3. Copy and paste the following code into the file.

    <script type="text/javascript">$(document).ready(function() { 
    $('[name="checkout"]').attr('disabled', 'disabled');
    window.ZapietEvent.listen('widget_loaded', function() {
    $('[name="checkout"]').removeAttr('disabled');
    });
    });
    </script>

  4. It can be placed anywhere in the theme.liquid file.

  5. Click Save.

    Checkout button will now be locked until Zapiet - Pickup + Delivery has fully loaded.


Troubleshooting

If the code is not working, try adding jQuery on top of the cart file, e.g. cart.liquid, cart-template.liquid, main-cart.liquid, main-cart-footer.liquid etc.

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> 

Did this answer your question?