5

Magento versión: 2.1.7

I have a configurable product with ALL its simple products without stock. I need to show in the configurable product the swatches of size / color (disabled) of their associated simple products.

Is this possible?

I already developed a modification and if at least 1 simple product has stock it shows all the swatches (available and not available).

The problem is if there's no stock of any simple product of configurable.

1
  • can you please share the code you have changed before? Dec 19, 2018 at 9:23

1 Answer 1

3

I've found this workaround:

I've overridden in my custom theme this phtml

vendor/magento/module-catalog/view/frontend/templates/product/view/form.phtml

Around line 35 you find

<?php if ($_product->isSaleable() && $block->hasOptions() && $block->getOptionsContainer() == 'container2'):?>

If you remove the condition $_product->isSaleable() you will get all the swatches visible

4
  • 1
    This doesn't work for me even after removing the condition, all swatches are not getting visible Dec 19, 2018 at 9:27
  • cool! it's working May 1, 2019 at 9:55
  • not working i apply this
    – Rv Singh
    Jul 22, 2019 at 12:38
  • v2.1.6 this doesn't help
    – Tobe_Sta
    Feb 20, 2020 at 1:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.