When using the Shopify Buy button solution for your checkout experience after an order is completed you may not want them to finish on a Shopify page but on your own website. Follow the steps below to transition the consumer to your site upon order success confirmation:
-
Make sure the pages page.shopify.liquid, page.shopifyError.liquid, page.shopifyRedirect.liquid, and page.success.liquid have been synced with the Shopify store.
-
In the Shopify store’s private apps, turn off write_themes and write_content permissions to stop future synchronization.
-
In the Shopify admin sidebar navigate to Sales Channels → Online Store → Themes. Open the Actions dropdown of the current theme and select Edit Code.
-
Edit page.shopifyRedirect.liquid, search for the declaration of function redirect() { and change the function to redirect to your own success page. You will need to pass the value of the id query param to your success page.
On your success page, retrieve your JSON order data by sending a GET request to
https://shipearlyapp.com/shopify/getShopifySuccess?id={id}&token={token}
using the id passed from page.shopifyRedirect.liquid and a token that can be found in page.success.liquid.
Id is the value passed from page.shopifyRedirect.liquid
JavaScript with jQuery example:
$.getJSON(
'https://shipearlyapp.com/shopify/getShopifySuccess',
{ token: token, id: id },
function(response) {
console.log(response);
}
).fail(function(jqXHR, textStatus, errorThrown) {
// Handle errors
});
PHP cURL example:
$query = http_build_query(array(
'token' => $token,
'id' => $id,
));
$ch = curl_init($url . '?' . $query);
curl_setopt_array($ch, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
));
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$errno = curl_errno($ch);
$error = curl_error($ch);
curl_close($ch);
if ($httpCode < 200 || $httpCode >= 300) {
// Handle HTTP error }
elseif ($errno) {
// Handle cURL error
}
print_r($response)
;
The raw JSON output will look as follows, which can be adjusted to the success page:
{
"customerEmail": "nick@shipearly.com",
"orderNo": "SE0016873",
"code": "U4LSRV",
"geopoints": {
"lat": "39.954358",
"lng": "-75.202369"
},
"formatAddress": "<b>Showroom Store<\/b><br\/>1706 Walnut St<br\/>Philadelphia, Pennsylvania<br\/>19103<br\/>Ph: 905-728-9956",
"customer_address": {
"first_name": "Nick",
"last_name": "Kolobutin",
"address1": "3935 Walnut Street",
"address2": "",
"city": "Philadelphia",
"country_code": "US",
"country_name": "United States",
"state_code": "PA",
"state_name": "Pennsylvania",
"zipcode": "19104",
"telephone": "(215) 555-1234",
"latitude": "39.954358",
"longitude": "-75.202369"
},
"price": "4786.98",
"shippingAmount": "0.00",
"discount_code": "TEST",
"discount": "50.00",
"taxamtwithShipping": "478.70",
"totalwithshipping": "5265.68",
"currency": "USD",
"type": "nonstock",
"redirectUrl": "https:\/\/sinul-bikes.myshopify.com",
"order_data": [
{
"product_id": 6408575555,
"sku": "ELEANOR-1",
"handle": "the-eleanor",
"product_title": "Accessory",
"variant_title": "Green",
"category": "Bag",
"image": "https:\/\/cdn.shopify.com\/s\/files\/1\/0895\/3120\/products\/70024-3-piece-tool-set-transparent-800px_150x150_cropped.png?v=1588773485",
"product_quantity": 2,
"unformattedunitprice": "169.99",
"price": "<span class='Currency' style='white-space: nowrap;'>USD 339.98<\/span>"
},
{
"product_id": 7528631363,
"sku": "BicycleBL",
"handle": "bicycle",
"product_title": "Bicycle",
"variant_title": "Blue \/ Large",
"category": "Bike",
"image": "https:\/\/cdn.shopify.com\/s\/files\/1\/0895\/3120\/products\/BK5771_150x150_cropped.png?v=1568707278",
"product_quantity": 3,
"unformattedunitprice": "1499.00",
"price": "<span class='Currency' style='white-space: nowrap;'>USD 4,497.00<\/span>"
}
],
"returnPolicy": "Sept 2019 Return Policy<br \/>\r\n<br \/>\r\nRETURNS & EXCHANGES<br \/>\r\n<br \/>\r\nWhile we\\'re always happy to honor returns or exchanges within 30 days of the delivery date, we can usually resolve any issues you might have without resulting in a return. Please feel free to reach out to us to discuss the reason for dissatisfaction with your order by contacting us directly.<br \/>\r\n<br \/>\r\nHow do I return a bike I purchased online?<br \/>\r\n<br \/>\r\nAfter the order has been submitted, the \\\"In-Store Pickup\\\" dealer is your primary point of contact for initiating returns or exchanges. \u201cIn-Store Pickup\u201d returns and exchanges must happen at the time of in-store pickup from a local participating Linus Bike dealer, and the item must be in original unused condition. Bike returns and exchanges incur a $35.00 per bike restocking fee. This restocking fee is applied to cover the shipment of the bike back to the manufacturer. You can only exchange for items of equal or greater value on \u201cIn-Store Pickup\u201d orders. In the event the item is exchanged, or a restocking fee is applied on a returned item, you must pay the local participating Linus Bike dealer the difference directly.<br \/>\r\n<br \/>\r\nIf you received the bike via the \u201cShip to Door\u201d delivery option, the bike needs to be shipped back to Linus. New or unused bikes can be returned within 30 days of when your order is received for a full refund. Items must be in their original condition to be eligible for a refund. All items refunded will be returned on the original method of payment when the order was placed. The refund will include the total value of the item plus applicable sales taxes charged.<br \/>\r\n<br \/>\r\nYou are responsible for shipping fees to return the item(s). For your own protection, we recommend you use a shipping method that can be tracked and insured. Linus is not responsible for any items lost in transit. Please ensure the product is repacked in the same manner as you received it to avoid any damages in transit. If the items are not packaged correctly, resulting in damages incurred in transit, those damages will be assessed by the Linus team and you will receive a refund, less damages incurred in transit.<br \/>\r\n<br \/>\r\n<br \/>\r\nDISCOUNTED ITEM PURCHASES ARE FINAL AND MAY NOT BE RETURNED OR EXCHANGED.<br \/>\r\n<br \/>\r\nHow do I return an accessory I purchased online?<br \/>\r\n<br \/>\r\nNew, unopened, or unused accessories can be returned within 30 days of when the items are received for a full refund. Items must be in their original condition to be eligible. All items refunded will be returned on the original method of payment when the order was placed. The refund will include the total value of the item plus applicable sales taxes charged. <br \/>\r\n<br \/>\r\nIf you received the item via the \u201cIn-Store Pickup\u201d delivery option, the item must be returned in-store in its original unused condition, to the local participating Linus Bike dealer where the item was picked up. The local participating Linus Bike dealer will need to process the return. Please maintain your order confirmation number as this is required to process a return.<br \/>\r\n<br \/>\r\n\u201cIn-Store Pickup\u201d returns and exchanges incur a $10.00 restocking fee per order. This restocking fee is applied to cover the shipment of the items back to the manufacturer. You can only exchange for items of equal or greater value on \u201cIn-Store Pickup\u201d orders. In the event the item is exchanged, or a restocking fee is applied to a returned item, you must pay the local participating Linus Bike dealer the difference directly.<br \/>\r\n<br \/>\r\nIf you received the item via the \u201cShip to Door\u201d delivery option, the item should be returned by shipping it back to Linus. You are responsible for shipping fees to return the item. For your own protection, we recommend you use a shipping method that can be tracked and insured. Linus is not responsible for any items lost in transit. Please ensure the product is repacked securely to avoid any damages in transit.<br \/>\r\n<br \/>\r\nDISCOUNTED ITEM PURCHASES ARE FINAL AND MAY NOT BE RETURNED OR EXCHANGED.<br \/>\r\n<br \/>\r\nI had my order assembled and delivered. How do I return it?<br \/>\r\n<br \/>\r\nOrders fulfilled through Velofix may be returned within 30 days of the delivery date. If you decide to return the bike, please send us an email or give us a call at 310-822-7722 with your order number and reason for the return. Once this information is received, Linus will schedule a Velofix representative to pick up the bike and packaging, free of charge.<br \/>\r\n<br \/>\r\nPlease note that items must be in their original, unused condition (including any packaging received) to be eligible for a refund. All refunds will be made to the original payment method when the order was placed. The refund will include the total value of the items plus applicable sales taxes charged, less a $39 return shipping fee.<br \/>\r\n<br \/>\r\nIf you would like to exchange the bike or accessories for another model, size, or color, you will need to place a new order via www.linusbike.com.<br \/>\r\n<br \/>\r\n <br \/>\r\n<br \/>\r\nDISCOUNTED ITEM PURCHASES ARE FINAL AND MAY NOT BE RETURNED OR EXCHANGED. <br \/>\r\n<br \/>\r\n <br \/>\r\n<br \/>\r\nIf I choose to return my \\\"Assembled & Delivered\\\" bike, can I get a refund of the $75 assembled & delivered fee?<br \/>\r\n<br \/>\r\n <br \/>\r\n<br \/>\r\nThe $75 assembly and delivery fee is non-refundable.<br \/>\r\n<br \/>\r\n <br \/>\r\n<br \/>\r\nI want to return or exchange an accessory that was delivered by Velofix. What do I do?<br \/>\r\n<br \/>\r\n <br \/>\r\n<br \/>\r\nNew or unused accessories can be returned within 30 days of delivery for a full refund. Items must be in their original, unused condition to be eligible for a refund. All items refunded will be returned on the original method of payment when the order was placed. The refund will include the total value of the item plus applicable sales taxes charged. For your own protection, we recommend you use a shipping method that can be tracked and insured. Linus is not responsible for any items lost in transit. Please ensure the product is repacked securely to avoid any damages in transit.<br \/>\r\n<br \/>\r\n<br \/>\r\nFollow these simple steps to return or exchange your purchase by mail: <br \/>\r\n<br \/>\r\n<br \/>\r\n- For returns or exchanges related to damaged or defective products, see below.<br \/>\r\n- For general returns or exchanges, contact us at hello@linusbike.com or 310.301.1866 with your original order #.<br \/>\r\n- On your original invoice, circle the item(s) that you\\'re returning and state the reason(s) for your return.<br \/>\r\n- Pack your return securely in the original package if possible, and include your completed invoice.<br \/>\r\n- Create your own pre-paid shipping label.<br \/>\r\n- Affix your shipping label to the package. Make sure no other tracking labels are shown.<br \/>\r\n- Take the package to your nearest drop off location.<br \/>\r\n- Within 30 days of receipt of the returned item we will refund the total amount less the original shipping fee charged at the time of purchase.",
"store_timing": "<span><b><a href=\"\" class=\"tooltip tooltip2069\" id=\"tooltip2069\" onclick=\"return false;\" style=\"display: inline-block; color: blue; opacity: 1; font-weight: inherit; font-size: inherit; position: relative; z-index: 1;\"><span>9:00 AM - 7:00 PM<\/span><\/a><\/b><\/span>",
"timing_list": "<div style=\"width: 220px;\"><span style=\"display: inline-block; width: 15%; text-align: left;\"> Mon <\/span><span style=\"display: inline-block; width: 83%; text-align: left;\"> - 9:00 AM - 7:00 PM<\/span><br\/><span style=\"display: inline-block; width: 15%; text-align: left;\"> Tue <\/span><span style=\"display: inline-block; width: 83%; text-align: left;\"> - 9:00 AM - 7:00 PM<\/span><br\/><span style=\"display: inline-block; width: 15%; text-align: left;\"> Wed <\/span><span style=\"display: inline-block; width: 83%; text-align: left;\"> - 9:00 AM - 7:00 PM<\/span><br\/><span style=\"display: inline-block; width: 15%; text-align: left;\"> Thu <\/span><span style=\"display: inline-block; width: 83%; text-align: left;\"> - 9:00 AM - 7:00 PM<\/span><br\/><span style=\"display: inline-block; width: 15%; text-align: left;\"> Fri <\/span><span style=\"display: inline-block; width: 83%; text-align: left;\"> - 9:00 AM - 7:00 PM<\/span><br\/><span style=\"display: inline-block; width: 15%; text-align: left;\"> Sat <\/span><span style=\"display: inline-block; width: 83%; text-align: left;\"> - 11:00 AM - 5:00 PM<\/span><br\/><span style=\"display: inline-block; width: 15%; text-align: left;\"> Sun <\/span><span style=\"display: inline-block; width: 83%; text-align: left;\"> - Closed<\/span><br\/><\/div>",
"trackingId": "UA-12345678-9",
"company_name": "Showroom Store",
"retailer_geopoints": {
"latitude": "39.9498714",
"longitude": "-75.1695637"
},
"google_conversion_label": "",
"brandsuccessmessage": "<div style=\"text-align: justify;\">Thank you for your purchase! You will receive an email confirmation shortly. Your estimated delivery date is below. Please provide the store pickup verification code to the retailer upon successfully receiving all of your items. If your shipment was split into two transactions you will receive a separate notification confirming the order. For any issues with your order contact <a href=\"mailto:sinulbikes@gmail.com\">sinulbikes@gmail.com<\/a>.<\/div>",
"shippingMethod_message": "Assembled Store Pickup",
"deliveryTime": "Ship to Store: Available in 3 Business Days"
}
"orderNo": "SE0016873", | Order ID on orders. For direct orders the standard ecommerce order ID will be used. On orders involving retailers the ShipEarly ID is used. |
"code": "U4LSRV", | Verification code provided to consumer they are to present to retailer at time of order collection to close the order out. |
"type": "nonstock", | Type is used to determine if the order is in stock "stock" or ship to store "nonstock" |
"company_name": "Showroom Store", | The retailers name, takes master or branch store description. |
"brandsuccessmessage": | Customer facing message displayed on success page |
"shippingMethod_message": "Assembled Store Pickup", | The type of fulfillment or button label the user selected. This is customizable in Checkout Settings. |
"deliveryTime": "Ship to Store: Available in 3 Business Days" | Underneath button label it is the timing presented to the consumer on the order. Can be reiterated on the success page. |
"returnPolicy": | The return policy on the order. If you wish to customize please get in contact with ShipEarly to modify. |
"trackingId": "UA-47462556-5", | Google Analytics Tracking ID. |
"price": "4786.98", | The subtotal of the entire order before shipping, taxes, and discounts. |
"shippingAmount": "0.00", | The total amount for shipping. It does not include shipping taxes. |
"discount_code": "TEST", | The name of the discount applied. If there is no discount it will be an empty string "". |
"discount": "50.00", | The amount of discount applied on the order. |
"taxamtwithShipping": "478.70", | Total tax applied on the order including if tax is applied to shipping. |
"totalwithshipping": "5265.68", | The total of the order including discounts, shipping, and taxes. |
Comments
0 comments
Please sign in to leave a comment.