I am new to coding in Magento 2. I am trying to override a file using this guide https://webkul.com/blog/overriding-rewriting-classes-magento2/, and my file compiles without error, but changes don’t take place on the frontend. I have put the file in a Hello World module called MyTest. My di.xml file located at app/code/[My_Vendor]/MyTest/etc/di.xml is
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCatalogPricingRenderFinalPriceBox"
type="[My_Vendor]MyTestRewritePricingRenderFinalPriceBox" />
</config>
and my FinalPriceBox.php file which overwrites vendor/magento/module-catalog/Pricing/Render/FinalPriceBox.php and is located at app/code/[My_Vendor]/MyTest/Rewrite/Pricing/Render/FinalPriceBox.php is
<?php
namespace [My_Vendor]MyTestRewritePricingRender;
class FinalPriceBox extends MagentoCatalogPricingRenderFinalPriceBox
{
public function _renderAmountMinimal()
{
$id = $this->getPriceId() ? $this->getPriceId() : ‘product-minimal-price-’ . $this->getSaleableItem()->getId();
$amount = $this->minimalPriceCalculator->getAmount($this->getSaleableItem());
if ($amount === null) {
return ‘’;
}
return $this->renderAmount(
$amount,
[
‘display_label’ => __(‘As low as mytest’),
‘price_id’ => $id,
‘include_container’ => false,
‘skip_adjustments’ => true
]
);
}
}
?>
I am not sure what is going wrong. I do not see any new error messages, and I know that changing the original file does cause the changes I want on the frontend. I also know that the module is enabled and correctly prints Hello World on a test page. The guide did not have a composer.json file so my module doesn’t have one, and I am not sure if that could cause the problem. I was wondering if anyone had advice on what might be going wrong