Vendor Number to Sales receipt


New to Lightspeed and have been asked to add the vendor number to each line on the sales receipt.

From what I can see we do not use any custom template for our Sales Receipts and I don't see any method to add the vendor number to our existing receipt.

Given that our invoice already has some custom messages I'm assuming that it is possible to add the vendor number without creating an entire custom template.

Can someone direct me to the area to do that?

Thanks in advance


  • Adrian SamuelAdrian Samuel Posts: 424Moderator, Lightspeed Staff moderator

    @LakesideJason You'll need to make an AJAX request to accomplish this. Can you program?

  • LakesideJasonLakesideJason Posts: 3Member

    A bit, let's just say I know just enough to be dangerous. So I know what an AJAX request is, but I would need some specific guidance on how to implement it to the Custom Template for a Sales Receipt

    Couple items to clarify;

    After digging, turns out we want the Inventory/Vendor ID displayed, not the actual vendor number. I can see the value in the Inventory, Item, Details page under the Inventory Defaults area

    As well, we do not have a Custom Template for our Sales Receipt, so I tried adding one and then using the solution in this post , however it didn't work as expected. I got the header on the invoice, but the item description took too much space and it seemed to merge with the quantity.

    Finally, unrelated, I'm trying this remotely, so I try to Preview the invoice under the Settings, Shop Setup, Receipt Setup area and the problem I'm seeing is it is laying the invoice out as a 8.5x11 format, where we use a Star printer. Do I need to setup a Star printer on my machine?

  • Adrian SamuelAdrian Samuel Posts: 424Moderator, Lightspeed Staff moderator
    edited March 15

    Hey @LakesideJason as a personal challenge I wrote a script to input the vendor ID on the sales receipt:

    You want to input the script after the following piece of HTML on line 1356 of the following Sales Receipt:

    <div class="receiptHeader">

    document.addEventListener("DOMContentLoaded", function() {
            (async () => {
                const domain =;
                const numbers = window.location.href.match(/\d{1,}/g);
                const RAD = numbers[0];
                const saleID = numbers[1];
                const domSales = document.querySelectorAll(' > tbody:nth-child(2) > tr> th > div:nth-child(1)');
                if (domSales.length > 0) {
                    const firstRowDescription = document.querySelector('body > div > > tbody:nth-child(1) > tr > th.description');
                    firstRowDescription.insertAdjacentHTML('afterend', '<th style="white-space:nowrap">Vendor Num</th>');
                const reqSale = await fetch(`https://${domain}/API/Account/${RAD}/DisplayTemplate/Sale/${saleID}.json`, {
                    credentials: 'same-origin'
                const getSale = await reqSale.json();
                let sales = getSale.Sale.SaleLines.SaleLine;
                if (!Array.isArray(getSale.Sale.SaleLines.SaleLine)) {
                    sales = [getSale.Sale.SaleLines.SaleLine];
                sales.forEach(async (item, idx) => {
                    const itemNumber = item.itemID;
                    if (itemNumber > 0) {
                        const reqItem = await fetch(`https://${domain}/API/Account/${RAD}/Item/${itemNumber}.json?load_relations=["ItemVendorNums"]`, {
                            credentials: 'same-origin'
                        const getItem = await reqItem.json();
                        if (getItem.Item.hasOwnProperty('ItemVendorNums')) {
                            let vendorNumbers = getItem.Item.ItemVendorNums.ItemVendorNum;
                            if (!Array.isArray(getItem.Item.ItemVendorNums.ItemVendorNum)) {
                                vendorNumbers = [getItem.Item.ItemVendorNums.ItemVendorNum];
                            const theVendorNumber = vendorNumbers[0].value;
                            domSales[idx].parentNode.insertAdjacentHTML('afterend', `<td style="text-align:center"> ${theVendorNumber}</td>`);
                        } else {
                            domSales[idx].parentNode.insertAdjacentHTML('afterend', '<td> </td>');
                    } else {
                        domSales[idx].parentNode.insertAdjacentHTML('afterend', '<td> </td>');
    Post edited by Adrian Samuel on
  • Adrian SamuelAdrian Samuel Posts: 424Moderator, Lightspeed Staff moderator

    As an additional word of note @LakesideJason neither myself nor the support team will be able to assist in the maintenance, support or implementation of this template. Please see this as a guide more than anything...but it should work :)

    If you need further customisations, please feel free to reach out to our sales team who will be able to point you to our customisation partners who will be able to assist you at a cost.

  • HallieTT88HallieTT88 Posts: 6Member
    edited March 18

    @LakesideJason - We had the same issue - in our case, the vendor ID was the same as the manufacturer ID, and a Lightspeed customer support person was able to help export/import the vendor ID's into the manufacturer ID's for the items that were missing that information. Then they were able to add it to the receipt. Or you can use the custom ID field for the same purpose if you aren't using that otherwise. We only need this temporarily for a sale, so I'll turn it off after the sale. Not sure if that helps you, but thought it might be worth sharing!

Sign In or Register to comment.