Skip to content

How can i get order data using credit memo plugin in Magento 2?

Here I used the credit memo plugin for updating the order data after refund success so how
can I get order data in that function?

etc/adminhtml/di.xml

    <?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="MagentoSalesApiCreditmemoRepositoryInterface">
        <plugin name="add_data_custom"
                type="VendorModuleModelPluginCreditmemoAddData"/>
    </type>

plugin file

public function afterSave(
    MagentoSalesApiCreditmemoRepositoryInterface $subject,
    $result
) {

 //   here I need order is//

    return $result;
}