Thank You for the code!
I modified your code to get the best result. But still, long color, size, and other attribute name is a problem. Bcoz some part of the name will be cropped on mobile, but that’s ok for me.
Here is my CSS code:
@media only screen and (max-device-width: 600px)
{
div.product table.variations tr {
min-height: 100px;
display: inline-block;
}
div.product table.variations tr .value {
width: 150px;
}
div.product table.variations tr:nth-of-type(1n) {
margin-right: .4em;
}
}
@media only screen and (min-device-width: 800px)
{
div.product table.variations tr {
min-height: 100px;
display: inline-block;
}
div.product table.variations tr .value {
width: 200px;
}
div.product table.variations tr:nth-of-type(1n) {
margin-right: .4em;
}
}
I also added a snippet to change the Attribute selection label to “Select”. If anyone wants to do the same, you can use this code.
/* Change Woocommerce Default Value Text */
add_filter('gettext', 'choose_option');
add_filter('ngettext', 'choose_option');
function choose_option($translated) {
$translated = str_ireplace('Choose an option', 'Select', $translated);
return $translated;
}
Result:https://ibb.co/MCqpQFg