Skip to content

Workaround for error with re-order process in Magento 2.4.6 and Mage-OS 1.0.7.

License

Notifications You must be signed in to change notification settings

seanbreeden/configunavailablefix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

  ______                                                              
 /      \                                                             
|  $$$$$$\  ______    ______   _______                                
| $$___\$$ /      \  |      \ |       \                               
 \$$    \ |  $$$$$$\  \$$$$$$\| $$$$$$$\                              
 _\$$$$$$\| $$    $$ /      $$| $$  | $$                              
|  \__| $$| $$$$$$$$|  $$$$$$$| $$  | $$                              
 \$$    $$ \$$     \ \$$    $$| $$  | $$                              
  \$$$$$$   \$$$$$$$  \$$$$$$$ \$$   \$$                                                                                      
 _______                                       __                     
|       \                                     |  \                    
| $$$$$$$\  ______    ______    ______    ____| $$  ______   _______  
| $$__/ $$ /      \  /      \  /      \  /      $$ /      \ |       \ 
| $$    $$|  $$$$$$\|  $$$$$$\|  $$$$$$\|  $$$$$$$|  $$$$$$\| $$$$$$$\
| $$$$$$$\| $$   \$$| $$    $$| $$    $$| $$  | $$| $$    $$| $$  | $$
| $$__/ $$| $$      | $$$$$$$$| $$$$$$$$| $$__| $$| $$$$$$$$| $$  | $$
| $$    $$| $$       \$$     \ \$$     \ \$$    $$ \$$     \| $$  | $$
 \$$$$$$$  \$$        \$$$$$$$  \$$$$$$$  \$$$$$$$  \$$$$$$$ \$$   \$$

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.

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);
    }
}

About

Workaround for error with re-order process in Magento 2.4.6 and Mage-OS 1.0.7.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages