0

i want to set "Qty to refund" column value as 0 by default and then i will update qty for only those product which i want to refund. i tried to set value as 0 but after that the "Update Qty" button does not update the qty and again set the quantity as 0.

is there any solution to fix this?

enter image description here Thanks in advancde.

1 Answer 1

1

Please overwrite the below file and update the code.

vendor/magento/module-sales/view/adminhtml/templates/order/creditmemo/create/items/renderer/default.phtml

<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ ?> <?php /** @var $block \Magento\Sales\Block\Adminhtml\Items\Renderer\DefaultRenderer */ ?> <?php $_item = $block->getItem() ?> <?php $block->setPriceDataObject($_item); ?> <?php $om = \Magento\Framework\App\ObjectManager::getInstance(); /** @var \Magento\Framework\App\RequestInterface|\Magento\Framework\App\Request\Http $request */ $request = $om->get('Magento\Framework\App\RequestInterface'); $request->isXmlHttpRequest(); if (!$request->isXmlHttpRequest()) { $_item->setQty(0); } ?> <tr> <td class="col-product"><?= $block->getColumnHtml($_item, 'name') ?></td> <td class="col-price"> <?= $block->getColumnHtml($_item, 'price') ?> </td> <td class="col-ordered-qty"><?= $block->getColumnHtml($_item, 'qty') ?></td> <?php if ($block->canParentReturnToStock($_item)) : ?> <td class="col-return-to-stock"> <?php if ($block->canReturnItemToStock($_item)) : ?> <input type="checkbox" class="admin__control-checkbox" name="creditmemo[items][<?= (int) $_item->getOrderItemId() ?>][back_to_stock]" value="1"<?php if ($_item->getBackToStock()) : ?> checked<?php endif; ?>/> <label class="admin__field-label"></label> <?php endif; ?> </td> <?php endif; ?> <td class="col-refund col-qty"> <?php if ($block->canEditQty()) : ?> <input type="text" class="input-text admin__control-text qty-input" name="creditmemo[items][<?= (int) $_item->getOrderItemId() ?>][qty]" value="<?= (float) $_item->getQty() ?>"/> <?php else : ?> <?= (float) $_item->getQty() ?> <?php endif; ?> </td> <td class="col-subtotal"> <?= $block->getColumnHtml($_item, 'subtotal') ?> </td> <td class="col-tax-amount"><?= /* @noEscape */ $block->displayPriceAttribute('tax_amount') ?></td> <td class="col-discont"><?= /* @noEscape */ $block->displayPriceAttribute('discount_amount') ?></td> <td class="col-total last"> <?= $block->getColumnHtml($_item, 'total') ?> </td> </tr> 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.