Product
Magento\Catalog\Model\Product
What it does
The Product class is the core model for managing catalog products in Magento 2.
Developers use this class to load, create, update, and manipulate product data including attributes, pricing, inventory, images, categories, and product relationships (related, upsell, cross-sell).
It provides methods for product validation, URL generation, option handling, and integration with indexing and caching systems.
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()