8
votes
Accepted
Magento 2: How to delete order's invoice, credit memo & shipment programmatically?
There are few steps are required for this.
Load order by Order Factory
Inject the factory class \Magento\Sales\Model\OrderFactory on __construct class.for getting order.
Then order get by order id
...
7
votes
Programmatically create a credit memo
If you need to refund online you should use as this way:
$order = Mage::getModel('sales/order')->loadByIncrementId('1117575');
$service = Mage::getModel('sales/service_order', $order);
$...
6
votes
Accepted
How to override a block without name?
You can use setChild() to replace a block by its alias. First create the new block with a name, then call setChild() via <action>:
<referenceBlock name="order_items">
<block class="...
4
votes
How do you get only visible items in a credit memo
One can use the following condition to get only visible items in creditmemo collection.
foreach ($creditMemo->getAllItems() as $item) {
if ($item->getOrderItem()->getParentItem()) ...
4
votes
Magento 2 : Add Custom Field To Order, Invoice, Shipment, Credit Memo
I give my answer about order email. Other emails and pdf should works with the same logic.
You have to look at \vendor\magento\module-sales\view\frontend\layout\sales_email_order_items.xml
where the ...
4
votes
Delete/undo wrong credit memo
One principle in accounting: don't change what you have done, add something to correct it.
The credit memo was created, to remove part of an earlier sale (and act as an accounting instruction / ...
4
votes
Accepted
magento 2 Programmatically create a credit memo by script
Here is the script for creating credit memo from Magento root
Create createcreditmemo.php at the root of magento
use \Magento\Framework\App\Bootstrap;
include('app/bootstrap.php');
$bootstrap = ...
3
votes
Accepted
How to extend creditmemo save action in magento 2
You should try with Plugin. The code below will work:
etc/adminhtml/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:...
3
votes
Accepted
How to add my block and phtml file in magento 2 with reference block
To add fee box in refund total block we need to remove adjustments block using
<referenceBlock name="adjustments" remove="true"/>
and then add your block in creditmemo_totals reference
...
3
votes
How to get credit memo collection from last 2 weeks in magento2
You can include only \Magento\Sales\Model\ResourceModel\Order\Creditmemo\Collection in your constructor, in this case, you can use directly "addFieldToFilter" function without declaring or include ...
3
votes
Credit Memo for Grand Total is Zero
Its blocked in the Code. If the total paid amount is smaller the 0.0001, then you can't create a Credit Memo.
app/code/core/Mage/Sales/Model/Order.php
if (abs($this->getStore()->roundPrice($...
3
votes
magento 2 Programmatically create a credit memo by script
Your Can Creaditmemo Using Below code.
protected $refundOrder;
public function __construct(
\Magento\Sales\Model\RefundOrder $refundOrder,
\Magento\Sales\Model\Order\Creditmemo\...
3
votes
Accepted
How to override items.phtml in module ? (Magento 2)
Try:-
create a sales_email_order_creditmemo_items.xml
path:-
app/code/Vendor/Module/view/frontend/layout/sales_email_order_creditmemo_items.xml
<?xml version="1.0"?>
<layout xmlns:...
2
votes
Accepted
Negative qty on credit memo PDF printout
The items of a credit memo PDF are rendered in Mage_Sales_Model_Order_Pdf_Items_Creditmemo_Default, around line 77.
Rewrite the model from a custom extension and change
$lines[0][] = array(
...
2
votes
How to credit-memo and/or return-to-stock a "completed" $0 order?
I ran into the same problem but I approached the solution a bit differently using di preferences; here is the code:
My/Module/etc/adminhtml/di.xml
<config xmlns:xsi="http://www.w3.org/2001/...
2
votes
Credit memo vs Refund Which one is true? Magento 1.9
Magento has two different ways to refund an Invoice.
The obvious way is to open the order and click on the Credit Memo Button at the top. On this view, you only see the Refund offline Button.
The ...
2
votes
Accepted
Get the about to be refunded qty in credit memo (partials refunds)
The issue was that I was looping over the products. This works:
$collection = $observer->getEvent()->getCreditmemo();
foreach ($collection->getAllItems() as $item) {
echo $item->...
2
votes
Please confirm returns logic
It depends on magento edition. In magento 2 enterprise or community edition it is by default but in community version it is not there by default. Either you have to built custom solution or buy a ...
2
votes
Accepted
How to get Creditmemo ID from sales_order_creditmemo_refund?
You will have an entity_id only after the object has been saved to database, therefore the earliest event to get that value is sales_order_creditmemo_safe_after.
But an increment_id can be generated ...
2
votes
Accepted
Layout handle not working in creditmemo admin email template
The problem is that the template is not updated to the new format.
A work-around is to set the is_legacy column to 1 in the database table email_template.
2
votes
Accepted
Magento 2 : change text "Refund Offline to Refund Store credit"
You can translate text via i18n as per your locale.
The file should be at app/design/adminhtml/Shah/default/i18n/en_US.csv
You can download code from here.
OR
you can translate inline to enabling from ...
2
votes
Accepted
How to refund only part of an order programmatically
I would use the API methods for the generation of the refund. You can basically call the API class method responsible for the endpoint https://magento.redoc.ly/2.4.2-admin/tag/orderorderIdrefund#...
2
votes
Magento 2 : Error "Unable to create credit memo for order"
See this for how flag ForcedCanCreditmemo property was set. Note that this property is just for current instance not a field in database, also cannot be saved.
https://github.com/magento/magento2/blob/...
1
vote
How to update Customer Order in Magento 1.9.3.1
Do credit memo from backemd, returm to stock and ctreate new order in backend
1
vote
Can I cancel a credit memo?
A colleague of mine did some research and this SQL queries should revert a credit memo. This should work, if there was only one credit memo - always use at your own risk. Make backups. Use with care.
...
1
vote
Accepted
How to get grandtotal (refunding amount) in credit memo transactional email
{{var creditmemo.grand_total}} helps to get grand total refunded in credit memo email template.
1
vote
Credit memo vs Refund Which one is true? Magento 1.9
Magento default don't have online refund. For online refund, you need to go to payment gateway side and click on the refund option from the transanctions list.
Magento only have offline refund feature,...
1
vote
Accepted
How to get credit memo collection from last 2 weeks in magento2
If I'm understanding your question correctly, you want to load all credit memos created in the last 2 weeks, regardless of when the order was created. Have you looked at using the service contracts ...
1
vote
Accepted
Double invoice for same order error
To resolve this in the admin just make credit memos of the duplicate invoices and make sure to fill out 0 as the quantity to return to stock.
As to debugging this: found out who is creating these ...
1
vote
Credit Memo Online or Offline?
First of all whether a credit memo can be done online depends on the payment methods used for that order. Note that online means that a payment gateway was involved during the payment process. If a ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
creditmemo × 179magento2 × 51
refund × 40
magento-1.9 × 39
orders × 22
invoice × 19
sales-order × 14
magento-1.7 × 10
magento-1.8 × 8
admin × 7
store-credit × 7
database × 5
magento-1 × 5
api × 5
payment × 5
pdf × 5
collection × 4
magento2.4 × 4
email-templates × 4
paypal × 4
magento2.2.2 × 4
transactional-mail × 4
shipment × 4
totals × 4
product × 3