like it says on the title, I want to 'customize' in a manner of speaking the reorder function that appears on the 'My Orders' section in the Customer Dashboard. What I have to do is to remove that link from that page and create a new 'sub menu' in the Dashboard (which I already have done) and list there only the last order and that's the one that will have the reorder function (this is a client's requirement). Is there any way to easily remove the 'reorder' link without tampering with Magento's core? I thought of creating a "preference" in the di.xml and do my own phtml without the link, but I think that there has to be a way to do it cleaner and more efficient, if so can anyone point me in the right direction? Also to only list the last order in the new section I created I thought of the same thing but I think that it wouldn't be efficient. Thanks in advance.
1 Answer
To disable reorder option you can do it by administrative panel:
- STORES -> Settings -> Configuration
- Click on Sales under Sale in left panel
- Go to Reorder section and set
No
inAllow Reorder
If you want you can also do it by code copying the file from:
vendor/magento/module-sales/view/frontend/templates/order/history.phtml
To:
app/design/frontend///Magento_Sales/templates/order/history.phtml
Then remove or customize conditional canReorder()
:
<?php if ($this->helper('Magento\Sales\Helper\Reorder')->canReorder($_order->getEntityId())) : ?>
....
<?php endif ?>
-
Thanks, this helped me a little along the way, but what I needed was to show only the "reorder" action for the last order, at first I was told to do it on a separate section, but in the end we agreed to do it on the "My orders" section. Jul 25, 2018 at 13:12