Overriding Loader.php to fix undefined getConfigurableAttributeCollection() method (Magento 2)

Sometimes you need to override the class Magento\ConfigurableProduct\Helper\Product\Options\Loader.php . This may be necessary, for example, to fix the Call to undefined method Magento\Catalog\Model\Product\Type\Simple\Interceptor::getConfigurableAttributeCollection() issue. A custom Magento 2 extension is often the best place for this override. Follow these steps:…

Overriding TierPriceBox.php for configurable products (Magento 2)

If you want to customize Magento 2 tier prices on configurable product pages, you may need to override the vendor/magento/module-configurable-product/Pricing/Render/TierPriceBox.php class. Here is how: Add the following content to the di.xml file in your extension:

Now create the class…

Dynamically changing the SKU of a configurable product in Hyvä (Magento 2)

In Hyvä (and Magento generally), the displayed SKU does not change automatically when a shopper selects different options for a configurable product. A small code change can fix this. Override the file /vendor/hyva-themes/magento2-default-theme/Magento_ConfigurableProduct/templates/product/view/type/options/js/configurable-options.phtml in your Hyvä child theme as follows:…

Creating a modal dialog with a close button in Hyvä (Magento 2)

Hyvä makes it easy to create custom modal dialogs. Start by building your Hyvä modal like this:

You can open the dialog with any HTML element. The following example uses a span element rendered as a Hyvä question mark…

Unlocking an indexer (Magento 2)

Sometimes one or more Magento 2 indexes become locked and cannot be rebuilt using the normal command:

The message might look like this: Product EAV index is locked by another reindex process. Skipping. To resolve it, unlock or invalidate…