fbpx
Want To Add Extra Images Per Product Variation For Free? Download Now

Nadine Frick

Hi,

quick question. We have a product with 2 soldout variations. But instead of soldout the button says “select version” – there’s no version to select anymore.

We still want the product in the shop so the button needs to say “soldout”

vessa2.JPG

Is there a code to add for that? Thank you

Rezwan Shiblu

Hi there,

Thanks for reaching out to us. It’s not related to our swatches plugin.

However, you can try the below code by using the code snippet plugin –

add_filter( 'woocommerce_loop_add_to_cart_link', 'filter_loop_add_to_cart_link', 20, 3 );
function filter_loop_add_to_cart_link( $button, $product, $args = array() ) {
if( $product->is_in_stock() ) return $button;

// HERE set your button text (when product is not on stock)
$button_text = __('Sold Out', 'woocommerce');

return sprintf( '<a class="button disabled" style="%s">%s</a>', $style, $button_text );
}

Video instruction – https://www.loom.com/share/f68adbaa09c04863b494faa01432bb03

Let me know if this helps.

Thank you.