Log in
Model

Value

Magento\Catalog\Model\Product\Option\Value

What it does

This class represents individual values for product custom options in Magento 2, such as dropdown choices or radio button options.

Developers use this class when working with selectable product options - for example, when creating a "Size" dropdown with values like "Small", "Medium", "Large", each with its own price and SKU.

It handles saving, retrieving, duplicating, and calculating prices for these option values.

Public Methods

  • addValue()
  • getValues()
  • setValues()
  • unsetValues()
  • setOption()
  • unsetOption()
  • getOption()
  • setProduct()
  • getProduct()
  • saveValues()
  • getPrice()
  • getRegularPrice()
  • getValuesCollection()
  • getValuesByOption()
  • deleteValue()
  • deleteValues()
  • duplicate()
  • getTitle()
  • getSortOrder()
  • getPriceType()
  • getSku()
  • getOptionTypeId()
  • setTitle()
  • setSortOrder()
  • setPrice()
  • setPriceType()
  • setSku()
  • setOptionTypeId()