Articles on: CornerCart

How to customize checkout behaviour in Corner Cart ?

By default, Corner Cart redirects to Shopify's default checkout page when a visitor clicks on the Checkout button in the cart. However, in some cases, you may want the user to be redirected to a custom checkout page or you may want to implement some other custom behaviour. Fortunately, you can do this easily with the help of the following function available in our Cart SDK.

Step 1: Use the Override Checkout Function

To override the default checkout behaviour, use the corner.overrideCheckout() function. This function takes a callback function as its parameter, and that callback function will be executed whenever the user clicks the checkout button. Here's an example code snippet:

corner.overrideCheckout((cartObject, discountCodeApplied) => {
  console.log("Checkout Triggered");
});


Step 2: Paste the Code into the Script Editor

Now that you have the code snippet, you can paste it into your script editor in Corner Cart. To access the script editor, go to Cart Drawer > Advanced Settings > Script Editor.

Where to find the script editor

Step 3: Customize the Callback Function (Optional)

The corner.overrideCheckout() function also provides two parameters that you can use inside the callback function for more advanced functionalities:

cartObject: The Cart Object
discountCodeApplied: Any discount codes applied using the cart.
Feel free to customize the callback function to suit your needs.

Conclusion


In conclusion, overriding the default checkout behaviour in Corner Cart is easy with the corner.overrideCheckout() function. Use it to redirect the user to a custom checkout page or to implement any other custom behaviour you want.

Updated on: 26/06/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!