when product out of stock single page show button notify woo-commerce
Question
when product out of stock single page show notify woocommerce, i am doing this code but showing button only archive page, i want to show single page any one help for code
https://imgur.com/dKmlKgM
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 = __('Not available', 'woocommerce');
return sprintf( '<a class="button disabled" style="%s">%s</a>', $style, $button_text );
}
0
woocommerce, wordpress.org
2 years
2020-08-22T06:10:20-05:00
2020-08-22T06:10:20-05:00 0 Answers
63 views
0
Leave an answer