Citrus-Lime Knowledge Base

Sorry, we didn't find any relevant articles for you.

    Checkout V4 // Accessing Order Information

    Information on scraping data from the Checkout V4 order confirmation page for use with Google Tag Manager

    There are two hidden input fields on the checkout v4 order confirmation page that store all information associated with that order. The data in these inputs can be scraped to use with third-party integrations via Google Tag Manager.


    Differences between V3 and V4

    All order and customer information can still be accessed in the same manner between v3 and v4, however names of the properties on the object have been modified to support the newer v4 database schema. The tabs below can be used to cross-reference the differences in schema.

     

    Checkout V4

    Order Information

    This input contains all information relevant to the order and can be retrieved with the following JavaScript:

    const orderInformation = JSON.parse(document.getElementById('orderItemsJSONHidden').value)

    This is formatted to the FinalisedOrder interface, which is structured as below.

    interface FinalisedOrder {
        id: number;
        orderNumber: number | null;
        customerId: number;
        customerEmail: string;
        isGuestCheckout: boolean;
        despatchType: string;
        itemTotal: number;
        subTotal: number;
        deliveryTotal: number;
        grandTotal: number;
        couponsTotal: number;
        giftCertificatesTotal: number;
        giftVouchersTotal: number;
        customerRewardsTotal: number;
        taxTotal: number;
        paymentMethod: string | null;
        specialInstructions: string;
        billingAddress: FinalisedOrderAddress | null;
        deliveryAddress: FinalisedOrderAddress | null;
        lines: FinalisedOrderLine[];
        deliveryService: FinalisedOrderDeliveryService | null;
        customerEmailHashed: string;
        customerPhoneNumberHashed: string;
        finalisedOn: string;
        status: FinalisedOrderStatus | null;
    }
    
    interface FinalisedOrderAddress {
        firstName: string;
        lastName: string;
        companyName: string | null;
        line1: string;
        line2: string | null;
        city: string;
        state: string | null;
        postcode: string;
        country: string;
        phoneNumber: string;
    }
    
    interface FinalisedOrderLine {
        itemName: string;
        imageUrl: string;
        itemCode: string;
        attributeName: string | null;
        attributeCode: string | null;
        price: number;
        itemPrice: number;
        quantity: number;
        grandTotal: number;
        appliedCouponCodes: string[];
        itemUrl: string;
        subTotal: number;
        customBuilderAttributes: string | null;
    }
    
    interface FinalisedOrderDeliveryService {
        name: string | null;
        storeCode: string | null;
        estimatedDeliveryTo: Date;
        estimatedDeliveryFrom: Date;
        estimatedDespatch: Date;
    }

    All information can be retrieved by using standard object referencing. For example, to retrieve the delivery address, you'd reference like so:

    const orderInformation = JSON.parse(document.getElementById('orderItemsJSONHidden').value);
    
    const orderDeliveryAddress = orderInformation.deliveryAddress;

    Customer Information

    This input contains all information relevant to the customer:

    const customerInformation = JSON.parse(document.getElementById('customerJSONHidden').value)

    This is formatted to the Customer interface, which is structured as below.

    interface Customer {
        customerId: number;
        marketingConsent: boolean;
        emailAddress: string;
        emailSource: string;
        firstName: string;
        lastName: string;
        isGuest: boolean;
    }

    Information can be retrieved using standard object reference, like so:

    const customerInformation = JSON.parse(document.getElementById('customerJSONHidden').value)
    
    const customerId = customerInformation.customerId;
     
     

    Checkout V3

    Customer data 

    document.getElementById('customerJSONHidden').value

    {
           "m_oCustInfo": {
               "FirstName": "Mister",
               "DateModified": "2021-04-09T10:44:48",
               "Referer": 0,
               "RefererDate": "",
               "HttpReferer": "",
               "CustomerGroup": 0,
               "TradeAccount": false,
               "TradeAccountNumber": "",
               "Balance": 0.0,
               "Currency": "GBP",
               "LanguageCode": "GB",
               "Email": "iam@theonewhoknocks.com",
               "ID": 364112,
               "LastName": "Heisenberg",
               "Subscribed": true
            },
           "m_bValid": false,
           "m_strErrorMessage": null,
           "m_strSessionID": "18e5a8c4-3509-42fc-9da6-6fb119352b5e",
           "m_bSignedIn": true,
           "m_nCustomerID": 364112,
           "m_objAddresses": [{
               "ID": 292844,
               "Type": 7,
               "NickName": "",
               "Name": "Mister Heisenberg",
               "FirstName": "Mister",
               "LastName": "Heisenberg",
               "MI": "",
               "Company": "Citrus Lime Ltd",
               "Address1": "Lantern House",
               "Address2": "The Ellers",
               "City": "Ulverston",
               "State": "",
               "Zip": "LA12 0AA",
               "Country": "GB",
                "Phone": "01229588628",
               "Fax": "",
               "EMail": "iam@theonewhoknocks.com",
               "CountryName": null,
               "URL": null,
               "Image": null,
               "MenSizingChart": "",
               "WomensSizingChart": "",
               "UnisexSizingChart": "",
               "BrandInfo": "",
               "BlockCoupons": false,
               "BrandPageTitle": "",
               "BrandH1Tag": "",
               "MetaDescription": ""
            }],
           "m_nCustomerGroup": 0,
            "m_objSavedCart": null,
           "m_strWishListSavedCartMessage": null,
           "m_strOandaRate": "",
           "m_strOandaISO": ""
        }


    order items 
    document.getElementById('orderItemsJSONHidden').value

    {
               "m_bDropShip": false,
               "Brand": "Patagonia",
               "VendorEmail": "vendordemo@citruslime.com",
                "SavedVendorName": null,
               "SavedBOQty": 0,
               "OrderItemID": 590989,
               "GiftWrapQty": 0,
               "CustomerGroup": 0,
               "GiftWraps": [],
               "ItemPrice": 140.00,
               "ItemTotal": 140.00,
                "ItemSavings": 0.0,
               "ItemSavingPercentage": 0.0,
               "CycleSchemeSurchargeValue": 0.0,
               "AttributesTotal": 0.0,
               "DetailLink": "../detailfast.aspx?ID=204861",
               "AttributesWeight": 0.0,
               "Downloaded": false,
               "IsItemEbay": false,
               "ProductName": null,
               "BlockFinance": false,
               "BlockCoupons": false,
               "MajorItem": false,
               "IsCustomBuilder": false,
                "MMIsActive": false,
               "DealTimeIsActive": false,
               "Gender": "male",
               "ProductID": 204861,
               "Weight": 0.0,
               "Length": 0.0,
               "Height": 0.0,
               "Width": 0.0,
               "ProductCode": "85250-BLK",
               "ShipFromID": 3.0,
               "CategoryParent": "Store",
               "CategoryParentIDS": [
                   "540"
                ],
               "CategoryNames": "",
               "Name": "Patagonia Torrentshell 3L Pullover Black",
                "PluralName": "Patagonia Mens Waterproof Torrentshell 3L Pullover Jacket Black",
               "IsOnSale": false,
               "IsAboveMinSaleThreshold": false,
               "Price": 140.00,
               "SalePrice": 140.00,
               "DiscountLevel": 0.0,
               "IsGiftWrapable": false,
               "GiftWrapPrice": 0.0,
               "SmallImage": "/platformlayout/clear.gif",
               "Inventory": {
                   "_CanBO": false,
                   "m_IsTracked": true,
                   "m_lngProdId": 204861,
                   "m_status": false,
                   "_DefaultQty": 0,
                   "m_LowFlag": 0,
                   "_Notify": false,
                   "_LowStock": false
                },
               "LargeImage": "/platformlayout/clear.gif",
               "Description": null,
               "ShortDescription": null,
               "Vendor": "Demo Vendor",
               "Manufacturer": "Patagonia",
               "VendorID": 2,
               "ManufacturerID": 75,
               "Attributes": [{
                   "AttributeDetails": [{
                       "Code": "85250-BLK-S",
                       "Name": "Small, Black",
                       "UID": 167876,
                       "AttributeID": 21040,
                       "CustomerSpecificAttributePrice": 0.0,
                       "Order": 0,
                       "Name_Price_Info": "Small, Black",
                       "CartPrice": "",
                       "Price": 0.0,
                       "Required": true,
                       "FilePath": "",
                       "Weight": 0.0,
                       "PriceChange": 1,
                       "WeightChange": 1,
                       "SmallImage": null,
                       "LargeImage": null,
                       "Customor_Custom_Description": "",
                        "Description": ""
                    }],
                   "Name": "Size Colour",
                   "UID": 21040,
                   "Required": true,
                   "AttributeType": 0
                }],
               "RelatedProducts": [],
               "DropShip": false,
               "HasLocalTax": false,
               "Cost": 54.68,
               "HasCountryTax": true,
               "HasStateTax": false,
               "IsShipable": true,
               "ShipPrice": 0.0,
               "UpSellMessage": null,
                "FileName": "",
               "CartItemId": "6a4e924d-ded1-46ee-86ca-e6c8f5948343",
               "DownloadExpire": "",
               "DownloadOneTime": false,
               "FullCategoryList": [
                   "93",
                   "68",
                   "540",
                   "68",
                   "540",
                   "540",
                   "591",
                   "93",
                   "68",
                   "540"
                ],
               "DespatchTime": {
                   "MinDays": 0,
                   "MaxDays": 0,
                   "DelayDuetoWeekend": false
                },
               "ShippingDelay": 1,
               "ShippingDelayText": "",
               "PreLaunch": false,
               "PreLaunchDate": "0001-01-01T00:00:00",
               "m_nQuantity": 1,
                "Quantity": 1,
               "CountryTaxPercentage": 0.0,
               "StateTaxPercentage": 0.0,
               "LocalTaxPercentage": 0.0
            }
     
     

     

    Was this article helpful?

    Still can't find
    what you are looking for?

    Our support team is here to help you.

    Contact Support

    Knowledge Base Software powered by Helpjuice