Multiple templates for printing labels

gtuckgtuck Member Posts: 1

We use three different styles of labels depending on the product. Is there a way to create and use multiple label templates?

1 comment

  • roberto_panseraroberto_pansera Moderator, Lightspeed Staff Posts: 39 moderator

    Hi Gtuck,

    You have 2 options:

    You can customize a template with a developer or with one of our partners (like https://advision-ecommerce.com) or you can try to use this solution offered by one of our colleagues. This solution is not a supported one, because you will be customizing your template.

    You can insert the code below on your template, that will generate a text box where you can type the name of the template you want to use. (the templates need to be previously added on Lightspeed and it is case sensitive.


    Insert the first part before after the block content and before the <div

    document.addEventListener('DOMContentLoaded', () => {
        const body = document.querySelector('body');
        body.insertAdjacentHTML('afterbegin', `<input class="remove_me" type="text">`)
        body.insertAdjacentHTML('afterbegin', `<button class="remove_me"> Change Template </button>`)
        const button = document.querySelector('button');
        button.addEventListener('click', () => {
            const input = document.querySelector('input').value;
            const url = window.location.href;
            window.location.href = url.replace(/ItemLabel/g, input)
    
    
        })
    })
    

    Insert the second part after the body bracket highlighted in blue (this one is to remove the buttons when printing the labels)

    @media print {
        .remove_me {
            display: none;
        }
    }
    

    I hope it can helps you

    Regards

    Roberto

Sign In or Register to comment.