# Magento dev tricks and tips

##### 1/ To debug email sending code:

  
For example, when placing an order in FrontEnd; the order immediately gets marked as processed; and the quote is cleared. In order to debug sending email:

in file `vendor/magento/module-checkout/Controller/Onepage/Success.php`, disable this code: `$session-&gt;clearQuote();`

##### 2/ Store object in memory per session

There is a deprecated technique still being used in Magento: use registry to store objects in memory.  
Example:

```
$this->registry->unregister('current_creditmemo');<br></br>$this->registry->register('current_creditmemo', $creditmemo);
```