Integrate Revy Bundles with any Store Pickup App
Note: This guide is not made for a specific Store Pickup / Local Delivery App, but any app of this type can integrate within our app using these commands.
Note 2: We do recommend using the Shopify app In Store Pickup Local Delivery that has a built-in integration with our Revy Bundle App, no manual code is needed using this app.
The problem with Revy Bundle app and Store Pickup apps is that our Revy Bundle app takes control of the checkout button, by doing this it won't let the StorePickup apps validate their form in the cart page before checkout.
The solution to integrate Revy Bundle with those apps is to intercept the checkout click and validate the StorePickup fields before going to checkout.
Fortunately our app has a rich API that can be used to intercept the checkout redirect and continue it(in case of valid StorePickup fields) or stop it (in case of invalid StorePickup fields).
WARNING: The code below requires changes to be usable, the StorePickup developer needs to update it accordingly. Don't simply copy and paste it without knowing what are you doing.
We do recommend put this code in the bottom of the file snippets/revy-bundle-script.liquid
<script> window.revyBundleDataLayer = window.revyBundleDataLayer || []; window.revyBundleDataLayer.push({onReady: function() { window.RevyBundle.api.checkoutValidator = function() { if(STORE_PICKUP_FIELDS_ARE_VALID) { // Here you must validate the StorePickup app fields return true; // Returning true it continues the checkout redirect } else { // Here you must write the code in case of validation fails, some apps shows some warning signals on the UI saying why failed return false; // Returning false it stops the app from redirect } } }}); </script>
The changes required on this example code are:
1. Replace "STORE_PICKUP_FIELDS_ARE_VALID" with a function or a variable that returns if the StorePickup fields are valid or not.
2. In the line before the "return false;", we do recommend triggering some type of UI element that shows to the customer what is wrong with the StorePickup fields, it may be an Alert or turn red the invalid fields, this is up to the StorePickup app developer, but we do recommend showing the error when returning false, so the customer knows why is failing the checkout redirect.
We believe with this code any developer from a StorePickup app can integrate with our app perfectly, but we are open to suggestions and questions on the email [email protected].
We are always open to a deep integration as well, if you are a StorePickup App developer and wish to integrate without the need to use this custom code in every store, please contact us at [email protected] and we can coordinate the integration between the apps.