Change toolbar text only for order history page

I need to change text of toolbar amount just in order history page in customer dashboard and show only 5 items per page without displaying limiter. Help please

Answers 1

  • Create Plugin on Magento\Theme\Block\Html\Pager and changed output of getAvailableLimit

    Plugin Class:

    <?php
    /**
     * Copyright ©  All rights reserved.
     * See COPYING.txt for license details.
     */
    declare(strict_types=1);
    
    namespace StackExchanges\Magento\Plugin\Frontend\Magento\Theme\Block\Html;
    
    class Pager
    {
    
        public function afterGetAvailableLimit(
            \Magento\Theme\Block\Html\Pager $subject,
            $result
        ) {
          if ($subject->getRequest()->getFullActionName() !== 'sales_order_history'){
              return $result;
          }
            return [7 => 7, 20 => 20, 50 => 50];
        }
    }
    
    • Put the pager.php at app/code/{Vendor}/{module}/Plugin/Frontend/Magento/Theme/Block/Html
    • You have must have di.xml at app/code/{Vendor}/{module}/etc/frontend/
    • app/code/{Vendor}/{module}/composer.json
    • module.xml at app/code/{Vendor}/{module}/etc app/code/{Vendor}/{module}/registration.php

Related Questions