Last active
December 24, 2024 12:20
-
-
Save JoryHogeveen/f32e552b94a16e49cbee4aeb8f57f091 to your computer and use it in GitHub Desktop.
Magento 2 - Admin console - Autofill empty swatch values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Autofill everything: | |
jQuery('#swatch-text-options-panel tbody tr').each( function() { var $tr = jQuery(this); var val = $tr.find( 'td:nth-child(4) input' ).val(); $tr.find( 'td:nth-child(3) input' ).val(val); } ); | |
// Autofill empty only: | |
jQuery('#swatch-text-options-panel tbody tr').each( function() { var $tr = jQuery(this); var val = $tr.find( 'td:nth-child(4) input' ).val(); var target = $tr.find( 'td:nth-child(3) input' ); if ( ! target.val() ) { target.val(val) } } ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just copy one of the lines below in your browser console to autofill swatch fields from it's label/description value. Afterwards you can finetune manually and save the attribute.