M2 Gift card is not compatible with M2.2.9

Created by Jane D, Modified on Mon, 20 Apr at 11:24 PM by Support Agent

QUESTION:


When I setup:di:compile, I got the error below:


 PHP Fatal error: Declaration of Bss\GiftCard\Block\Adminhtml\Items\Column\Name\GiftCard::truncateString($value, $length = 80, $etc = '...', &$remainder = '', $breakWords = true) must be compatible with Magento\Sales\Block\Adminhtml\Items\Column\Name::truncateString(string $value, int $length = 80, string $etc = '...', string &$remainder = '', bool $breakWords = true): string in /var/www/html/grandstores/app/code/Bss/GiftCard/Block/Adminhtml/Items/Column/Name/GiftCard.php on line 112


Please tell me how to fix it?


ANSWER:


The issue reported above due to the module M2 Gift Card is not compatible with M2.2.9.


To fix this issue, please edit the file app/code/Bss/GiftCard/Block/Adminhtml/Items/Column/Name/GiftCard.php as below:


Line 97, 98,99,100,101, 102:


From

    $value,

    $length = 80,

    $etc = '...', 

    &$remainder = '',

    $breakWords = true

 ) {


To

    string $value,

    int $length = 80,

    string $etc = '...',

    string &$remainder = '',

    bool $breakWords = true

    ): string {


If you need any further assistance, please feel free to leave us a message via https://bsscommerce.com/contact. We'd be happy to help you out.


Here are some information about BSS Commerce:


BSS Commerce is a trusted Magento 2 extensions provider with 14+ years of experience, serving 75,000+ customers worldwide. We are an Adobe Commerce Solution Bronze Partner and a Select Magento Extensions Builder, reinforcing our expertise in the Magento ecosystem.


We specialize in developing 150+ high-quality Magento 2 extensions that enhance functionality, improve user experience, and support scalable growth. Our reputation is built on long-term partnerships, positive feedback, and proven performance-driven solutions.


Explore our extensions: https://bsscommerce.com/magento-2-extensions.html 


For B2B businesses, our Magento B2B Extension by BSS Commerce is a flagship and widely adopted solution globally, offering advanced pricing, company account management, and streamlined workflows.


If you need any further assistance, please feel free to contact us.


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article