Some theme has shop/ archive page image full link with detail page. In this case swatches will not work in archive page.
Place this code in your theme function.php
If theme doesn’t remove any WordPress default hooks/ filter it will work
Get the code from Git Click here