title: Rename Add to Cart buttons for Out Of Stock Products in WooCommerce 3
body: <p>I would like to rename <strong><code>'Add to Cart'</code></strong> to <strong><code>'Sold Out'</code></strong> when product <strong>is sold out</strong> in WooCommerce.</p>
  
  <p>This is my code:</p>
  
  <pre><code>add_filter( 'add_to_cart_text', 'woo_custom_single_add_to_cart_text' );
  add_filter( 'woocommerce_product_single_add_to_cart_text', 
  'woo_custom_single_add_to_cart_text' );  // 2.1 +
  
  function woo_custom_single_add_to_cart_text() {
  
  if( $product-&gt;get_stock_quantity() == 0 )
      return __( 'Sold Out', 'woocommerce' );
  } else {
      return __( 'Add to cart ', 'woocommerce' );
  }
  </code></pre>
  
  <p><strong>But it's not working.</strong> </p>
  
  <p>What I am doing wrong please?</p>