title: How to hide / remove add to cart button in Woocommerce after adding the product to the cart
body: <p>Good day,<br />
  Before that, I searched here for a solution to the query but failed.<br />
  I need to hide / remove add to cart button in Woocommerce after adding the product to the cart, without affecting prices, quantities and product types (simple, variables, grouped, etc...).
  <em><strong>In General the idea is add checkout form in single product page</strong></em>.<br />
  <strong>You can visit the site to test from <a href="https://store.hatemfrere.com/" rel="nofollow noreferrer">HERE</a></strong><br />
  I use the following theme and plugins:<br /></p>
  <ul>
  <li>Free version of Astra Theme</li>
  <li>Snippets code Plugin</li>
  <li>Custom CSS and JavaScript Plugin</li>
  <li>Microthemer Plugin</li>
  </ul>
  <p>The following changes have been made by me:<br /></p>
  <p>1 - Redirect Add to cart in shop page<br />
  I changed the text of &quot;add to cart&quot; button to &quot;view product&quot; and redirected this button to the single product page, and this is the  used code</p>
  <pre><code>add_filter( 'woocommerce_loop_add_to_cart_link', 'replacing_add_to_cart_button', 10, 2 );
  function replacing_add_to_cart_button( $button, $product  ) {
      $button_text = __(&quot;View product&quot;, &quot;woocommerce&quot;);
      $button = '&lt;a class=&quot;button&quot; href=&quot;' . $product-&gt;get_permalink() . '&quot;&gt;' . $button_text . '&lt;/a&gt;';
  
      return $button;
  }
  </code></pre>
  <p>2 - Change add to cart text in single product page<br />
  I changed the text &quot;Add to cart&quot; to &quot;Buy now&quot; in the single product page and this is the used code</p>
  <pre><code>// Code Start
  // To change add to cart text on single product page
  add_filter( 'woocommerce_product_single_add_to_cart_text', 'woocommerce_custom_single_add_to_cart_text' ); 
  function woocommerce_custom_single_add_to_cart_text() {
      return __( 'Buy Now', 'woocommerce' );  // Replace &quot;Buy Now&quot; text with your own text
  }
  
  // To change add to cart text on product archives(Collection) page
  add_filter( 'woocommerce_product_add_to_cart_text', 'woocommerce_custom_product_add_to_cart_text' );  
  function woocommerce_custom_product_add_to_cart_text() {
      return __( 'Buy Now', 'woocommerce' );  // Replace &quot;By Now&quot; text with your own text
  }
  // Code End
  </code></pre>
  <p>3 - Short description of woocommerce by default<br />
  I have added the checkout page to the product page after pressing the buy now button, and this is the used code</p>
  <pre><code>add_filter('woocommerce_short_description','ts_add_text_short_descr');
  
  function ts_add_text_short_descr($description){
    $text=&quot;[woocommerce_checkout]&quot;;
      
    return $description.$text;
  }
  </code></pre>
  <p>4 - Empty cart if the user reaches the home page (shop page in my case)<br />
  I added a code to empty the cart when going to the home page (in my case the home page is the shop page) and this is the used code</p>
  <pre><code>/*empty cart if user come to homepage*/
  add_action( 'init', 'woocommerce_clear_cart_url' );
  function woocommerce_clear_cart_url() {
  global $woocommerce;
  
  if ($_SERVER['REQUEST_URI'] === '/') { 
      $woocommerce-&gt;cart-&gt;empty_cart(); 
   }
  }
  </code></pre>
  <p>Now what I want to do is that after pressing the buy now button (previously, add to cart) and the checkout page form fields appear, the buy now button is hidden or deleted (previously, add to cart) without affecting the product types or any thing else.<br />
  <br />
  I hope to find help from you or any recommended suggestions.
  best greetings</p>