I'm trying to locate where the dimensions for the Visual Swatches in Magento 2 are defined. Or if they are not longer configurable via the admin the block that defines them.


Sizes of swatches config in css file: vendor/magento/module-swatches/view/frontend/web/css/swatches.css in class: .swatch-option

So, you need overwrite swatches.css Just copy swatches.css to your module Your/Module/view/frontend/web/css/swatches.css and add file Your/Module/view/frontend/layout/catalog_product_view_type_configurable.xml with content

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <css src="Your_Module::css/swatches.css"/>

after this you can modify your swatches.css, after each modify you should run bin/magento setup:upgrade for clean cache, generation,etc

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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