Factory
CreditmemoDocumentFactory
Magento\Sales\Model\Order\CreditmemoDocumentFactory
What it does
This factory class creates credit memo documents in Magento 2, either from an order or from an invoice.
Developers use this when they need to programmatically generate credit memos for refunds, allowing them to specify items to refund, quantities, comments, and additional arguments like shipping amounts and adjustments.
Public Methods
- createFromOrder()
- createFromInvoice()