Model
Option
Magento\Catalog\Model\Product\Option
What it does
This class manages product custom options in Magento 2, allowing products to have configurable fields like text inputs, file uploads, dropdowns, and date pickers.
Developers use this class to programmatically create, retrieve, and manipulate product options that customers can select when purchasing products, such as engraving text, file uploads, or selecting variations with different prices.
Public Methods
- addValue()
- getValueById()
- hasValues()
- getValues()
- getValueInstance()
- addOption()
- getOptions()
- setOptions()
- unsetOptions()
- getProduct()
- setProduct()
- getGroupByType()
- groupFactory()
- beforeSave()
- afterSave()
- getPrice()
- deletePrices()
- deleteTitles()
- getProductOptions()
- getValuesCollection()
- getOptionValuesByOptionId()
- duplicate()
- getSearchableData()
- getProductSku()
- getOptionId()
- getTitle()
- getType()
- getSortOrder()
- getIsRequire()
- getPriceType()
- getSku()
- getFileExtension()
- getMaxCharacters()
- getImageSizeX()
- getImageSizeY()
- setProductSku()
- setOptionId()
- setTitle()
- setType()
- setSortOrder()
- setIsRequire()
- setPrice()
- setPriceType()
- setSku()
- setFileExtension()
- setMaxCharacters()
- setImageSizeX()
- setImageSizeY()
- setValues()
- getExtensionAttributes()
- getRegularPrice()
- getProductOptionCollection()
- setExtensionAttributes()