Is it possible to remove billing/shipping on checkout

I want to implement a cryptocurrency checkout for a restaurant. Therefore, I don’t need billing and/or shipping addresses to be filled out. Is there a way to remove these from the checkout process?

edit:
I have tried adding an empty tag in the div#snipcart section. It seems to jump straight to payment… I’m not sure if this works or not as I don’t have an external payment method set up yet

Hi @exabyte,

Unfortunately, it’s not possible to disable the billing step on the checkout page.

This information is currently required, so I’m afraid your workaround wouldn’t work as it will prevent any users from completing an order.

Although not ideal, I could only see this achieved by prefilling the billing information with dummy values using our JavaScript SDK at cart creation and hiding the checkout steps using CSS.

Concerning shipping, it can be disabled in the dashboard or by setting the “data-item-shippable” attribute in your product definitions to false.

Let me know if that helps,

Cheers!

That seems like a good solution! I am still relatively new to Javascript, I tried including the following into my js file that gets loaded with every page.

Is this the right way to go about it? At first, I simply had the try/catch block in the cart.created event listener, but would get an error saying I couldn’t get an error saying

await is only valid in async functions and the top level bodies of modules

So I created the fillBill function outside and calling that on cart.created. Seems to work well! I still need to try hiding with CSS and disabling shipping, but have to run for now.

Thanks for the help!

async function fillBill() {
    try {
        await Snipcart.api.cart.update({
            email: 'john.doe@example.com',
            metadata: {
                customMetadataKey: 'value'
            },
            billingAddress:{
                name: 'John Doe',
                address1: '3671 Garfield Road',
                city: 'Neponset',
                country: 'US',
                province: 'IL',
                postalCode: '61345'
            }
        });
    } catch (error) {
        console.log('error occurred');
        console.log(error);
    }
}

document.addEventListener('snipcart.ready', () => {
    console.log("snipcart ready");
    Snipcart.events.on('item.added', (cartItem) => {
        console.log("item added")
        console.log(cartItem);
    });
    Snipcart.events.on('cart.created', (cartState) => {
        console.log("cart created")
        console.log(cartState);
        fillBill();
    });
});

I can’t get this to work, I tried your FillBill function but no luck… just errors.

I want to update the billing address, but I cannot find a solution. Is there any more information or examples how to update the cart billing address?

@Forky can you tell us what the error you’re getting is?

Also, reading over my post, I typed something weird…

but would get an error saying I couldn’t get an error saying

should just be

but would get an error saying…

I get different errors like :

uncaught exception: Object

and

A 'system' error occured in Snipcart.iframe's load timed out 
Object { data: iframe, kind: "system", code: "snipcart_error_operation_failed", message: "snipcart_error_operation_failed", technicalReason: "iframe's load timed out" }

and the billing does not update. When I try updating only the email address it works, using the following simple method…

Snipcart.api.cart.update({
	email: 'test@example.com'
});

can you show all the code that’s not working? It seems like you might be running into a problem with the asynchronous nature of the Snipcart.api.update() method. Are you using await to make sure that it’s given time to resolve?

I’m in testing mode BTW. And I also have this issue all the time… maybe this is the problem?

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://cdn.snipcart.com/themes/v3.2.0/l10n/en-AU.json. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

Yes I tried using your code exactly as you wrote it.

But maybe it is this CORS thing… do you know if there’s a way to fix that without messing around with server? I’ve run out of ideas! Everything is working except one last thing… the updating of billing address. All other aspects work fine, like items in cart etc and checkout.
Thanks for help anyway. Maybe I should start a new thread.

yeah, sorry I wish I could help more but I’m not sure! I’m sure someone knows though, so a new thread sounds like a good idea, best of luck!

Hi @Forky

I tried your solution and everything works as expected. You can test it here.