Skip to content

Order Notes Methods

SmartCart.getNotesDataobject | null

Returns the notes state data from the SmartCart object (not the settings).

Example

// Get current notes data
const notesData = SmartCart.getNotesData();
if (notesData) {
  console.log('Current note:', notesData.value);
}

SmartCart.getNotesLabelstring

Returns the configured label for the notes input

SmartCart.getNotesPlaceholderstring

Returns the configured placeholder for the notes input

SmartCart.getNotesSettingsobject

Returns the notes settings from the SmartCart object.

SmartCart.notesChangevoid

Handles updating the notes value

Param Type Description
event Event DOM user action event

SmartCart.notesEnabledboolean

Returns a boolean indicating whether or not the notes component is enabled (ie. not hidden)

Example

// Check if order notes are enabled
if (SmartCart.notesEnabled()) {
  console.log('Order notes feature is available');
}

SmartCart.notesIsVisibleboolean

Returns a boolean indicating whether or not the notes input is visible to customer

SmartCart.notesRemainingCharactersstring

Returns a string containing the remaining characters message

Example

// Display remaining characters in a custom UI
const remaining = SmartCart.notesRemainingCharacters();
document.querySelector('.char-count').textContent = remaining;
// Output: "50 characters remaining"

SmartCart.notesTogglevoid

Handles toggling the visibility of the notes input

Example

// Toggle notes visibility with a custom button
document.querySelector('.toggle-notes-btn').addEventListener('click', () => {
  SmartCart.notesToggle();
});
See something that needs updating? Suggest an edit