Custom Field on Labels

CCFS_ZachCCFS_Zach Member Posts: 29 ✭


I recently read an article on how certain item information can be pulled using javascript in the print templates. Mainly, what I'm trying to do is put our shelf locations for items on the labels so that everything gets put in the right location once it's received.

Based on this article, it appears that it's possible to use the javascript within the print templates and grab specific item information, such as custom fields. That being said, I have a "ShelfLocation" custom field and am trying to grab its information and add to my label.

Here is a link to the article:

Also, a user posted their Github with their templates; the label template includes a portion where the custom field is obtained. I tried implementing this portion of the code, but it doesn't seem to return anything (or I'm just not sure how to print the obtained information as text)

Github link:

Additionally, here is the specific code used to attempt to grab the 'Custom Field' information:

                 (async() => {
                    const request = await fetch('{{ Account ID}}/Item/{{ Label.Item.itemID }}.json?load_relations=["CustomFieldValues"]', {credentials:"same-origin"});
                   const response = await request.json();
                  if( === "ShelfLocation") { document.getElementById("shelflocation").textContent = response.Item.CustomFieldValues.CustomFieldValue.value};
<div id="shelflocation" class="description">

If I could just get the tag information and put it on the label, that would work as well.

Has anyone worked with this before? Or does anyone have a suggestion on what I can do?




1 comment

  • CCFS_ZachCCFS_Zach Member Posts: 29 ✭

    As a side note, I did make sure to replace the "{Account ID}" in the link with my Lightspeed Account ID.

Sign In or Register to comment.