An ability to block / disable checkout

oroberman
New Member
2 0 1

Hello,
I'm about to write some shopify delivery app. 

I would like to know if there is a way to disable/block the particular checkout in case, for instance, I have no drivers available? 

Kumaar001
Tourist
3 0 0

Hello Oroberman,

You can pause your store in the Shopify Admin under Settings > Account. Please visit this link with the detailed process you need to follow in order to complete the deactivation: https://docs.shopify.com/manual/configuration/store-customization/page-specific/product-page/how-do-... 

I hope these resources help you!

Regards,

Kumaar from Huptechweb Pvt Ltd

 

0 Likes
Kumaar001
Tourist
3 0 0

Hii Oroberman,

If you want to keep your store running but you don't want to offer checkout functionality, you can pause your store in the Shopify Admin (under Settings > Accounts). This will make your store "dorment", which disables checkout. To do this, you simply have to write this is to your theme. 

...ok, maybe not so simple! Depending on the theme, it can be tricky, but here are the 3 basic steps:

1. Add a Theme Setting: Go to the Shopify Theme Template Editor and open configs/settings.html. Add the following bit of code at the very bottom to add the box that will allow you to disable the "Add to Cart" button: 

<fieldset>
  <legend>Checkout Function</legend>
    <table>
    <tr>
      <td><label for="disable_checkout">Disable add to cart and checkout?</label></td>
      <td><input type="checkbox" id="disable_checkout" name="disable_checkout" /></td>
    </tr>
    <tr>
       <td><label for="coming_soon_msg">Replace Price with message</label></td>
      <td><input type="text" id="coming_soon_msg" name="coming_soon_msg" value="" /></td>
    </tr>
  </table>
</fieldset>

 

2. Hide the Cart Links: This is where it can get a little tough since this step can be different depending on the theme you are using. You'll need to identify instances of the cart in the theme. liquid file. You'll need to find for the navigation bar with the cart buttons, then add the following just before: {% unless settings.disable_checkout %} and add this just after: {% endunless %}. 

3. Hide the Add to Cart Button: Again, this step can vary depending on the theme (ahh, so complicated!) but you will need to look in either product.liquid or in a snipped called product-form.liquid (or something similar...crystal clear eh?). In this file, look for the <form> code. This is what controls the adding to the cart as it's submitted via an HTML form. You should see a line like {% if product.available %}. This lets the theme show the item as sold out if the inventory is 0 and we don't sell below zero.

We want to find that code, and surround it with the following:

{% unless settings.disable_checkout %} and end it with

 {% else %}

    <p class="price"> {{ settings.coming_soon_msg }}</p>

 {% endunless %}

Hope that was helpful!! 

Cheers,

Kumaar from Huptechweb Pvt Ltd.

0 Likes
oroberman
New Member
2 0 1

Hey,

Thank you for the prompt reply. However, seems I didn't describe my question well. 

I don't need to disable the checkout permanently. I want be able to disable / stop checkout for a particular order if no drivers, who can deliver the goods, available. 

So the flow is like:

1. user add some goods to his cart

2. user go to the cart and press "check out"

3. on the checkout page user set "shipping/delivery" and set the address 

* here I need to be able to check for the driver availability and if no driver available at selected time, area ... I would like to prevent the checkout.

 

0 Likes