Type Alias: MarkOptionByBlockNameAndOptionCode()
MarkOptionByBlockNameAndOptionCode = (
blockName,optionCodeOrInputValue) =>void
Function
Selects an option using human-readable block name and option code, or sets a value for special widgets.
This convenience function allows for selecting options using their business identifiers rather than internal IDs. It's particularly useful for integrations and automated configurations where human-readable references are preferred over technical identifiers.
For standard option blocks, this method finds the option by its code and selects it. For special widget types (slider, text, number, color, etc.), the second parameter is interpreted as the input value rather than an option code.
Supported Widget Types
| Widget Type | Second Parameter | Description |
|---|---|---|
| Standard (dropdown, swatch, etc.) | optionCode | The code of the option to select |
| Slider | inputValue | Numeric value within the slider's range |
| Text | inputValue | Text string value |
| Number | inputValue | Numeric value |
| Color | colorValue | Hex color value (e.g., "#FF0000") |
For more complex widgets (image, print on demand, engrave) or full control,
use markOption directly. See the Programmatic Configuration Control guide.
Parameters
blockName
string
The display name of the block containing the option
optionCodeOrInputValue
The option code for standard widgets, or the input value for special widgets (slider, text, number, color)
string | number
Returns
void
Promise that resolves when the selection is complete
Examples
// Select a standard option by code
await markOptionByBlockNameAndOptionCode("TableTop", "FINISH-OAK");
// Set a slider value
await markOptionByBlockNameAndOptionCode("Width", 150);
// Set a text input value
await markOptionByBlockNameAndOptionCode("CustomLabel", "My Product");
// Set a number input value
await markOptionByBlockNameAndOptionCode("Quantity", "25");
// Set a custom color
await markOptionByBlockNameAndOptionCode("CustomColor", "#3498db");