Auto-select the shipping and payment method at checkout

Add a JavaScript file that picks the only shipping and payment method for shoppers so checkout is faster.

Where to find it: Settings > Store Information > Experimental Features for the setting, or Theme > gear icon > Manage Theme Assets for the script. Part of Manage Assets: add custom CSS, JavaScript and HTML.

When a customer has only one shipping method or one payment method to choose from, Zoey can choose it for them and skip that checkout step, so checkout is faster.

Use it to:

  • Skip the Shipping Method step when only one shipping rate applies.
  • Skip the Payment Method step when only one offline payment method applies, such as Net Terms or Check / Money Order.

Turn On Skip Checkout Steps

  1. In the Zoey Admin, go to Settings > Store Information and select Experimental Features.
  2. Set Allow Skip Checkout Steps to Yes.
  3. Click Save.
Allow Skip Checkout Steps set to Yes in Experimental Features

When a Step Is Skipped

Zoey checks each order at checkout. If any condition isn't met, the customer sees the step as usual.

StepSkipped when
Shipping MethodExactly one shipping rate is available for the order's address and it has no error. The step always shows when ShipperHQ is turned on, when there are order attributes on the shipping method step, or when the contact needs approval to place the order (they submit it for approval from this step). Orders with no shipping (virtual products only) always skip it.
Payment MethodExactly one payment method is available and it's an offline method. The step always shows for Purchase Order (the customer has to enter a PO number), for card payments, when you have active Terms and Conditions at checkout, or when there are order attributes on the payment step.
📘

The customer still reviews the order

Skipping a step only picks the one available option. The customer still sees the shipping method and payment method on the order review before placing the order.

Use a Script Instead

If the setting doesn't fit your checkout, you can add this script to your theme instead. It clicks Continue for the customer on the shipping method and payment steps as soon as they load, so use it only when customers never need to change those steps. Test a checkout on your store after adding it.

  1. In the Zoey Admin, click Theme, click the gear icon at the top right, and select Manage Theme Assets.
  2. In Site code & files, click + Add and select Write new code.
Add to your site window with Write new code, Upload a file and Logo or favicon
  1. Set What kind of code? to JavaScript, enter a Name such as Auto-select Shipping or Payment, leave Use it on as Whole site, and click Create.
Write new code window with JavaScript, a name and Use it on set to Whole site
  1. Paste the script below into the editor and click Save & close. The script goes live on your store when you save.

To skip only the shipping method step, comment out the startPaymentStep(); line as noted in the script.

if (window.location.href.toLowerCase().indexOf("checkout/onepage") >= 0) {
    jQuery(function() {

        // Shipping step logic
        var shipmentMethodButtonInterval = setInterval(function(){ 
            if(jQuery('#checkout-step-shipping_method').is(':visible')){
                console.log('Shipping method loaded!!');
                clearInterval(shipmentMethodButtonInterval);
                setTimeout(function(){
                    jQuery("#shipping-method-buttons-container > button").trigger("click");
                }, 1);
            }
        }, 100);

        // Hook into native XMLHttpRequest to detect saveShippingMethod
        (function(open) {
            XMLHttpRequest.prototype.open = function(method, url) {
                this._url = url; // Track the URL
                return open.apply(this, arguments);
            };
            XMLHttpRequest.prototype.send = (function(send) {
                return function() {
                    this.addEventListener('load', function() {
                        if (this._url && this._url.indexOf('saveShippingMethod') !== -1) {
                            console.log('saveShippingMethod XHR complete, starting payment step check...');
                            //comment this out if you are not hiding the payment step
                            startPaymentStep();
                        }
                    });
                    return send.apply(this, arguments);
                };
            })(XMLHttpRequest.prototype.send);
          
          // Comment out this function to not skip payment method
          function startPaymentStep() {
            var paymentMethodButtonInterval = setInterval(function(){ 
                if(jQuery('#checkout-step-payment').is(':visible') && jQuery("#payment-buttons-container > button").length){
                    console.log('Payment method loaded and button ready!!');
                    clearInterval(paymentMethodButtonInterval);
                    setTimeout(function(){
                        jQuery("#payment-buttons-container > button").trigger("click");
                    }, 1);
                }
            }, 100);
        }
          
        })(XMLHttpRequest.prototype.open);
    });
  
}

Related articles


Did this page help you?