What the title says. I want to stop user from deselecting product variants when he clicks on a product variant. Basically, a variant is always selected and he can’t clear it. I found php code online that worked on dropdown menus but not swatches.
This topic has 4 replies, 2 voices, and was last updated 12 months ago ago by Andrew Mitchell
What the title says. I want to stop user from deselecting product variants when he clicks on a product variant. Basically, a variant is always selected and he can’t clear it. I found php code online that worked on dropdown menus but not swatches.
Hello, ZEXAL,
Thank you for reaching out to us. Kindly try adding the following code to:
Customizer -> Theme Custom CSS -> Global CSS.
.st-swatch-preview-single-product .selected{
pointer-events:none;
}
a.reset_variations{
display:none!important;
}
Best regards,
The 8Theme Team
This part won’t work:
a.reset_variations{
display:none!important;
}
for anyone reading this and want to get rid of the clear button, add the following code to your functions.php in your child theme folder:
add_filter( 'woocommerce_reset_variations_link', '__return_empty_string', 9999 );
Dear ZEXAL,
Choosing our theme reflects your commitment to quality, and for that, we’re genuinely grateful. As we constantly strive to elevate your experience, your feedback is an invaluable gift. Could you kindly take a moment to rate our product with 5 stars on ThemeForest?
Click here to share your insights: https://themeforest.net/downloads
Your support fuels our journey, and we appreciate it more than words can express.
Best Regards,
The 8Theme Team
The issue related to '‘Custom php code to stop user from deselecting or clearing variants’' has been successfully resolved, and the topic is now closed for further responses