Magento 2.4.x: Selected option(s) or their combination is not currently available.

Side-profile picture of a man sitting, partially turned toward a computer screen. The white-outlined logos for Adobe and Magento are superimposed over the monitor.
Magento 2.4.x: Selected option(s) or their combination is not currently available.
Loading... 6 view(s) 2 min read

 

If you are trying to re-order Configurable Products using custom code in Magento 2.4.x or Mage-OS 1.0.x, then you might encounter this error message: 

 

"Selected option(s) or their combination are not currently available."

and/or:

"Some item options or their combination are not currently available."

 

I have a workaround.

Before the checkData() method is called, manually tell Magento that there are no errors.

Use this with extreme caution as it can mask legitimate Configurable Product errors.

This should only be used when the has_configuration_unavailable_error being set to true is causing a checkout problem with a custom configurable product.

Since the error block depends on the has_configuration_unavailable_error flag being true, resetting it to false means, Magento won’t add the “unavailable configuration” errors. This workaround only disables that specific part of the code while allowing the rest of checkData() to execute as intended.

You can access the entire module on GitHub at https://github.com/seanbreeden/configunavailablefix/

app/code/SeanBreeden/ConfigUnavailableFix/etc/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Sales\Controller\AbstractController\Reorder">
<plugin name="infinit_reorder_plugin" type="Infinit\Reorder\Plugin\ReorderPlugin"/>
</type>
<type name="Magento\Quote\Model\Quote\Item">
<plugin name="seanbreeden_configunavailablefix_item_checkdata_plugin" type="SeanBreeden\ConfigUnavailableFix\Plugin\Quote\ItemPlugin" />
</type>
</config>

 

app/code/SeanBreeden/ConfigUnavailableFix/Plugin/Quote/ItemPlugin.php

<?php
namespace SeanBreeden\ConfigUnavailableFix\Plugin\Quote;

class ItemPlugin
{
/**
* @param \Magento\Quote\Model\Quote\Item $subject
* @return void
*/
public function beforeCheckData(\Magento\Quote\Model\Quote\Item $subject)
{
$subject->setData('has_configuration_unavailable_error', false);
}
}

 

Previous article:
Comments
Leave your comment
Your email address will not be published