I want to change the look of the out of stock variant, so that it is distinctly different from the in stock buttons. Is there a way to isolate this specific css or other?
See below as it current default state and current hover state. Ideally, I’d like to change the the stroke, fill and type color of the out of stock button in both default and hover states.
Yes, you can definitely target out-of-stock variant buttons separately with CSS. Most Shopify themes apply a specific class (often something like .disabled, .soldout, or [disabled]) to those buttons. You can use that selector to style them differently from in-stock variants. For example:
You might need to adjust the class names depending on your theme. A quick way is to right-click the out-of-stock button in your browser → Inspect → check the class applied, and then use that in your CSS.
This way, the out-of-stock button will have its own distinct look in both default and hover states without affecting the in-stock ones.
.variant-option__button-label:has([data-option-available=false]) {
opacity: 0.5;
border-style: dashed; /* can also make border dashed. or whatever... */
}