Order Notes Methods
SmartCart.getNotesData ⇒ object | 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.getNotesLabel ⇒ string¶
Returns the configured label for the notes input
SmartCart.getNotesPlaceholder ⇒ string¶
Returns the configured placeholder for the notes input
SmartCart.getNotesSettings ⇒ object¶
Returns the notes settings from the SmartCart object.
SmartCart.notesChange ⇒ void¶
Handles updating the notes value
| Param | Type | Description |
|---|---|---|
| event | Event |
DOM user action event |
SmartCart.notesEnabled ⇒ boolean¶
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.notesIsVisible ⇒ boolean¶
Returns a boolean indicating whether or not the notes input is visible to customer
SmartCart.notesRemainingCharacters ⇒ string¶
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.notesToggle ⇒ void¶
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