Model
Product
Magento\Catalog\Model\Product
What it does
The Product model is the core class representing catalog products in Magento 2.
Developers use it to load, save, and manipulate product data including attributes, pricing, stock status, media gallery, product links (related, upsell, cross-sell), and custom options.
It provides comprehensive methods for product lifecycle management, indexing, and integration with the catalog system.
Public Methods
- getStoreId()
- getUrlModel()
- validate()
- getName()
- getPrice()
- getVisibility()
- getAttributeSetId()
- getCreatedAt()
- getUpdatedAt()
- setPriceCalculation()
- getTypeId()
- getStatus()
- getTypeInstance()
- setTypeInstance()
- getLinkInstance()
- getIdBySku()
- getCategoryId()
- getCategory()
- getCategoryIds()
- getCategoryCollection()
- getWebsiteIds()
- getStoreIds()
- getAttributes()
- beforeSave()
- canAffectOptions()
- afterSave()
- getCacheTags()
- setQty()
- getQty()
- priceReindexCallback()
- eavReindexCallback()
- isDataChanged()
- reindex()
- beforeDelete()
- afterDeleteCommit()
- cleanCache()
- getPriceModel()
- getPriceInfo()
- getTierPrices()
- setTierPrices()
- getTierPrice()
- getFormattedPrice()
- getFormatedPrice()
- setFinalPrice()
- getFinalPrice()
- getCalculatedFinalPrice()
- getMinimalPrice()
- getSpecialPrice()
- getSpecialFromDate()
- getSpecialToDate()
- getRelatedProducts()
- getRelatedProductIds()
- getRelatedProductCollection()
- getRelatedLinkCollection()
- getUpSellProducts()
- getUpSellProductIds()
- getUpSellProductCollection()
- getUpSellLinkCollection()
- getCrossSellProducts()
- getCrossSellProductIds()
- getCrossSellProductCollection()
- getCrossSellLinkCollection()
- getProductLinks()
- setProductLinks()
- getMediaAttributes()
- getMediaAttributeValues()
- getMediaGalleryImages()
- hasGalleryAttribute()
- addImageToMediaGallery()
- getMediaConfig()
- getVisibleInCatalogStatuses()
- getVisibleStatuses()
- isVisibleInCatalog()
- getVisibleInSiteVisibilities()
- isVisibleInSiteVisibility()
- isDuplicable()
- setIsDuplicable()
- isSalable()
- isAvailable()
- getIsSalable()
- isVirtual()
- isSaleable()
- isInStock()
- getAttributeText()
- getCustomDesignDate()
- getProductUrl()
- getUrlInStore()
- formatUrlKey()
- addAttributeUpdate()
- toArray()
- fromArray()
- getRequestPath()
- getGiftMessageAvailable()
- isComposite()
- canConfigure()
- getSku()
- getWeight()
- getOptionInstance()
- addOption()
- getOptionById()
- getProductOptionsCollection()
- getOptions()
- setOptions()
- getIsVirtual()
- addCustomOption()
- setCustomOptions()
- getCustomOptions()
- getCustomOption()
- hasCustomOptions()
- canBeShowInCategory()
- getAvailableInCategories()
- getDefaultAttributeSetId()
- reset()
- getCacheIdTags()
- isProductsHasSku()
- processBuyRequest()
- getPreconfiguredValues()
- prepareCustomOptions()
- getProductEntitiesInfo()
- isDisabled()
- getImage()
- getIdentities()
- reloadPriceInfo()
- __toArray()
- toFlatArray()
- setSku()
- setName()
- setStoreId()
- setAttributeSetId()
- setPrice()
- setStatus()
- setVisibility()
- setCreatedAt()
- setUpdatedAt()
- setWeight()
- setTypeId()
- getExtensionAttributes()
- setExtensionAttributes()
- getMediaGalleryEntries()
- setMediaGalleryEntries()
- getId()
- setId()
- setAssociatedProductIds()
- getQuantityAndStockStatus()
- setQuantityAndStockStatus()
- getStockData()
- setStockData()
- _resetState()