Order
Magento\Sales\Model\Order
What it does
The Order model class represents a sales order in Magento 2 and provides comprehensive functionality for managing orders throughout their lifecycle.
Developers use this class to load, manipulate, and retrieve order data including items, payments, addresses, shipments, invoices, and credit memos.
It handles order state transitions (new, processing, complete, canceled) and determines what actions can be performed on an order (ship, invoice, cancel, refund).
Public Methods
- unsetData()
- getActionFlag()
- setActionFlag()
- getCanSendNewEmailFlag()
- setCanSendNewEmailFlag()
- loadByIncrementId()
- loadByIncrementIdAndStoreId()
- loadByAttribute()
- getStore()
- canCancel()
- canVoidPayment()
- canInvoice()
- canCreditmemo()
- canHold()
- canUnhold()
- canComment()
- canShip()
- canEdit()
- canReorder()
- canReorderIgnoreSalable()
- isPaymentReview()
- canReviewPayment()
- canFetchPaymentReviewUpdate()
- getConfig()
- getPayment()
- setBillingAddress()
- setShippingAddress()
- getBillingAddress()
- getShippingAddress()
- setState()
- getFrontendStatusLabel()
- getStatusLabel()
- addStatusToHistory()
- addStatusHistoryComment()
- addCommentToStatusHistory()
- setHistoryEntityName()
- getEntityType()
- place()
- hold()
- unhold()
- cancel()
- isFraudDetected()
- registerCancellation()
- getTrackingNumbers()
- getShippingMethod()
- getAddressesCollection()
- getAddressById()
- addAddress()
- getItemsCollection()
- getParentItemsRandomCollection()
- getAllItems()
- getAllVisibleItems()
- getItemById()
- getItemByQuoteItemId()
- addItem()
- getPaymentsCollection()
- getAllPayments()
- getPaymentById()
- setPayment()
- getStatusHistoryCollection()
- getAllStatusHistory()
- getVisibleStatusHistory()
- getStatusHistoryById()
- addStatusHistory()
- getRealOrderId()
- getOrderCurrency()
- formatPrice()
- formatPricePrecision()
- formatPriceTxt()
- getBaseCurrency()
- formatBasePrice()
- formatBasePricePrecision()
- isCurrencyDifferent()
- getTotalDue()
- getBaseTotalDue()
- getData()
- getInvoiceCollection()
- setInvoiceCollection()
- getShipmentsCollection()
- getCreditmemosCollection()
- getTracksCollection()
- hasInvoices()
- hasShipments()
- hasCreditmemos()
- getRelatedObjects()
- getCustomerName()
- addRelatedObject()
- getCreatedAtFormatted()
- getEmailCustomerNote()
- getStoreGroupName()
- reset()
- getIsNotVirtual()
- prepareInvoice()
- isCanceled()
- getIncrementId()
- getItems()
- setItems()
- getAddresses()
- getStatusHistories()
- getExtensionAttributes()
- setExtensionAttributes()
- getAdjustmentNegative()
- getAdjustmentPositive()
- getAppliedRuleIds()
- getBaseAdjustmentNegative()
- getBaseAdjustmentPositive()
- getBaseCurrencyCode()
- getBaseDiscountAmount()
- getBaseDiscountCanceled()
- getBaseDiscountInvoiced()
- getBaseDiscountRefunded()
- getBaseGrandTotal()
- getBaseDiscountTaxCompensationAmount()
- getBaseDiscountTaxCompensationInvoiced()
- getBaseDiscountTaxCompensationRefunded()
- getBaseShippingAmount()
- getBaseShippingCanceled()
- getBaseShippingDiscountAmount()
- getBaseShippingDiscountTaxCompensationAmnt()
- getBaseShippingInclTax()
- getBaseShippingInvoiced()
- getBaseShippingRefunded()
- getBaseShippingTaxAmount()
- getBaseShippingTaxRefunded()
- getBaseSubtotal()
- getBaseSubtotalCanceled()
- getBaseSubtotalInclTax()
- getBaseSubtotalInvoiced()
- getBaseSubtotalRefunded()
- getBaseTaxAmount()
- getBaseTaxCanceled()
- getBaseTaxInvoiced()
- getBaseTaxRefunded()
- getBaseTotalCanceled()
- getBaseTotalInvoiced()
- getBaseTotalInvoicedCost()
- getBaseTotalOfflineRefunded()
- getBaseTotalOnlineRefunded()
- getBaseTotalPaid()
- getBaseTotalQtyOrdered()
- getBaseTotalRefunded()
- getBaseToGlobalRate()
- getBaseToOrderRate()
- getBillingAddressId()
- getCanShipPartially()
- getCanShipPartiallyItem()
- getCouponCode()
- getCreatedAt()
- setCreatedAt()
- getCustomerDob()
- getCustomerEmail()
- getCustomerFirstname()
- getCustomerGender()
- getCustomerGroupId()
- getCustomerId()
- getCustomerIsGuest()
- getCustomerLastname()
- getCustomerMiddlename()
- getCustomerNote()
- getCustomerNoteNotify()
- getCustomerPrefix()
- getCustomerSuffix()
- getCustomerTaxvat()
- getDiscountAmount()
- getDiscountCanceled()
- getDiscountDescription()
- getDiscountInvoiced()
- getDiscountRefunded()
- getEditIncrement()
- getEmailSent()
- getExtCustomerId()
- getExtOrderId()
- getForcedShipmentWithInvoice()
- getGlobalCurrencyCode()
- getGrandTotal()
- getDiscountTaxCompensationAmount()
- getDiscountTaxCompensationInvoiced()
- getDiscountTaxCompensationRefunded()
- getHoldBeforeState()
- getHoldBeforeStatus()
- getIsVirtual()
- getOrderCurrencyCode()
- getOriginalIncrementId()
- getPaymentAuthorizationAmount()
- getPaymentAuthExpiration()
- getProtectCode()
- getQuoteAddressId()
- getQuoteId()
- getRelationChildId()
- getRelationChildRealId()
- getRelationParentId()
- getRelationParentRealId()
- getRemoteIp()
- getShippingAmount()
- getShippingCanceled()
- getShippingDescription()
- getShippingDiscountAmount()
- getShippingDiscountTaxCompensationAmount()
- getShippingInclTax()
- getShippingInvoiced()
- getShippingRefunded()
- getShippingTaxAmount()
- getShippingTaxRefunded()
- getState()
- getStatus()
- getStoreCurrencyCode()
- getStoreId()
- getStoreName()
- getStoreToBaseRate()
- getStoreToOrderRate()
- getSubtotal()
- getSubtotalCanceled()
- getSubtotalInclTax()
- getSubtotalInvoiced()
- getSubtotalRefunded()
- getTaxAmount()
- getTaxCanceled()
- getTaxInvoiced()
- getTaxRefunded()
- getTotalCanceled()
- getTotalInvoiced()
- getTotalItemCount()
- getTotalOfflineRefunded()
- getTotalOnlineRefunded()
- getTotalPaid()
- getTotalQtyOrdered()
- getTotalRefunded()
- getUpdatedAt()
- getWeight()
- getXForwardedFor()
- setStatusHistories()
- setStatus()
- setCouponCode()
- setProtectCode()
- setShippingDescription()
- setIsVirtual()
- setStoreId()
- setCustomerId()
- setBaseDiscountAmount()
- setBaseDiscountCanceled()
- setBaseDiscountInvoiced()
- setBaseDiscountRefunded()
- setBaseGrandTotal()
- setBaseShippingAmount()
- setBaseShippingCanceled()
- setBaseShippingInvoiced()
- setBaseShippingRefunded()
- setBaseShippingTaxAmount()
- setBaseShippingTaxRefunded()
- setBaseSubtotal()
- setBaseSubtotalCanceled()
- setBaseSubtotalInvoiced()
- setBaseSubtotalRefunded()
- setBaseTaxAmount()
- setBaseTaxCanceled()
- setBaseTaxInvoiced()
- setBaseTaxRefunded()
- setBaseToGlobalRate()
- setBaseToOrderRate()
- setBaseTotalCanceled()
- setBaseTotalInvoiced()
- setBaseTotalInvoicedCost()
- setBaseTotalOfflineRefunded()
- setBaseTotalOnlineRefunded()
- setBaseTotalPaid()
- setBaseTotalQtyOrdered()
- setBaseTotalRefunded()
- setDiscountAmount()
- setDiscountCanceled()
- setDiscountInvoiced()
- setDiscountRefunded()
- setGrandTotal()
- setShippingAmount()
- setShippingCanceled()
- setShippingInvoiced()
- setShippingRefunded()
- setShippingTaxAmount()
- setShippingTaxRefunded()
- setStoreToBaseRate()
- setStoreToOrderRate()
- setSubtotal()
- setSubtotalCanceled()
- setSubtotalInvoiced()
- setSubtotalRefunded()
- setTaxAmount()
- setTaxCanceled()
- setTaxInvoiced()
- setTaxRefunded()
- setTotalCanceled()
- setTotalInvoiced()
- setTotalOfflineRefunded()
- setTotalOnlineRefunded()
- setTotalPaid()
- setTotalQtyOrdered()
- setTotalRefunded()
- setCanShipPartially()
- setCanShipPartiallyItem()
- setCustomerIsGuest()
- setCustomerNoteNotify()
- setBillingAddressId()
- setCustomerGroupId()
- setEditIncrement()
- setEmailSent()
- setForcedShipmentWithInvoice()
- setPaymentAuthExpiration()
- setQuoteAddressId()
- setQuoteId()
- setAdjustmentNegative()
- setAdjustmentPositive()
- setBaseAdjustmentNegative()
- setBaseAdjustmentPositive()
- setBaseShippingDiscountAmount()
- setBaseSubtotalInclTax()
- setBaseTotalDue()
- setPaymentAuthorizationAmount()
- setShippingDiscountAmount()
- setSubtotalInclTax()
- setTotalDue()
- setWeight()
- setCustomerDob()
- setIncrementId()
- setAppliedRuleIds()
- setBaseCurrencyCode()
- setCustomerEmail()
- setCustomerFirstname()
- setCustomerLastname()
- setCustomerMiddlename()
- setCustomerPrefix()
- setCustomerSuffix()
- setCustomerTaxvat()
- setDiscountDescription()
- setExtCustomerId()
- setExtOrderId()
- setGlobalCurrencyCode()
- setHoldBeforeState()
- setHoldBeforeStatus()
- setOrderCurrencyCode()
- setOriginalIncrementId()
- setRelationChildId()
- setRelationChildRealId()
- setRelationParentId()
- setRelationParentRealId()
- setRemoteIp()
- setStoreCurrencyCode()
- setStoreName()
- setXForwardedFor()
- setCustomerNote()
- setUpdatedAt()
- setTotalItemCount()
- setCustomerGender()
- setDiscountTaxCompensationAmount()
- setBaseDiscountTaxCompensationAmount()
- setShippingDiscountTaxCompensationAmount()
- setBaseShippingDiscountTaxCompensationAmnt()
- setDiscountTaxCompensationInvoiced()
- setBaseDiscountTaxCompensationInvoiced()
- setDiscountTaxCompensationRefunded()
- setBaseDiscountTaxCompensationRefunded()
- setShippingInclTax()
- setBaseShippingInclTax()
- setShippingMethod()