Fluent builder that creates or updates a SKU for a given product and SKU code. Configure it with a title, image, base cost, physical dimensions, custom fields, parameter options and per-location inventory quantities, then call build to persist the SKU and apply the configured inventory levels. Obtained by calling newProductSkuBuilder on the catalogManager service from server-side JavaScript.
Group: Builders
Methods
title(String s) · imageHash(String s) · baseCost(BigDecimal s) · baseCost(Double s) · weightKgs(BigDecimal s) · heightCm(BigDecimal s) · widthCm(BigDecimal s) · lengthCm(BigDecimal s) · field1(String s) · field2(String s) · field3(String s) · addInventory(InventoryLocation loc, Long quantity) · addParameterOption(ParameterOption po) · addParameterOption(String paramCode, String optCode) · build()
title(String s)
Returns: ProductSkuBuilder
Sets the SKU's display title.
| Parameter | Description |
|---|---|
s | the SKU's display title |
imageHash(String s)
Returns: ProductSkuBuilder
Sets the content hash of the SKU's image.
| Parameter | Description |
|---|---|
s | the content hash of the image data |
baseCost(BigDecimal s)
Returns: ProductSkuBuilder
Sets the SKU's base cost, before any pricing rules are applied.
| Parameter | Description |
|---|---|
s | the SKU's base cost |
baseCost(Double s)
Returns: ProductSkuBuilder
Sets the SKU's base cost, before any pricing rules are applied.
| Parameter | Description |
|---|---|
s | the SKU's base cost |
weightKgs(BigDecimal s)
Returns: ProductSkuBuilder
Sets the SKU's weight, in kilograms.
| Parameter | Description |
|---|---|
s | the SKU's weight in kilograms |
heightCm(BigDecimal s)
Returns: ProductSkuBuilder
Sets the SKU's height, in centimetres.
| Parameter | Description |
|---|---|
s | the SKU's height in centimetres |
widthCm(BigDecimal s)
Returns: ProductSkuBuilder
Sets the SKU's width, in centimetres.
| Parameter | Description |
|---|---|
s | the SKU's width in centimetres |
lengthCm(BigDecimal s)
Returns: ProductSkuBuilder
Sets the SKU's length, in centimetres.
| Parameter | Description |
|---|---|
s | the SKU's length in centimetres |
field1(String s)
Returns: ProductSkuBuilder
Sets the SKU's first custom field value.
| Parameter | Description |
|---|---|
s | the value for custom field 1 |
field2(String s)
Returns: ProductSkuBuilder
Sets the SKU's second custom field value.
| Parameter | Description |
|---|---|
s | the value for custom field 2 |
field3(String s)
Returns: ProductSkuBuilder
Sets the SKU's third custom field value.
| Parameter | Description |
|---|---|
s | the value for custom field 3 |
addInventory(InventoryLocation loc, Long quantity)
Returns: ProductSkuBuilder
Sets the stock quantity to apply at the given inventory location when the SKU is built.
| Parameter | Description |
|---|---|
loc | the inventory location to set stock for |
quantity | the stock quantity to apply at that location |
addParameterOption(ParameterOption po)
Returns: ProductSkuBuilder
Adds a parameter option that the SKU is built with, contributing to the combination of options that identifies it as a variant of the product.
| Parameter | Description |
|---|---|
po | the parameter option to add |
addParameterOption(String paramCode, String optCode)
Returns: ProductSkuBuilder
Adds a parameter option that the SKU is built with, looking up the parameter and option by their codes on the product.
| Parameter | Description |
|---|---|
paramCode | the code of the product parameter the option belongs to |
optCode | the code of the option to add |
build()
Returns: ProductSku
Persists the SKU, creating it if it does not already exist for this product and combination of parameter options, and applies the title, image, cost, dimensions, custom fields and per-location inventory quantities configured on this builder.