title: New style of cart button when item is in cart in WooCommerce
body: <p>I use a code that changes the text of the &quot;Add to Cart&quot; button for a product if the item is already in the cart.</p>
  <pre class="lang-php prettyprint-override"><code>/* for single product */
  add_filter( 'woocommerce_product_single_add_to_cart_text', 'single_product_button_text' );
   
  function single_product_button_text( $text ) {
   
      if( WC()-&gt;cart-&gt;find_product_in_cart( WC()-&gt;cart-&gt;generate_cart_id( get_the_ID() ) ) ) {
          $text = 'Product in cart';
      }
   
      return $text;
   
  }
   
  /* for archive/category pages */
  add_filter( 'woocommerce_product_add_to_cart_text', 'products_button_text', 20, 2 );
   
  function products_button_text( $text, $product ) {
   
      if( 
         $product-&gt;is_type( 'simple' )
         &amp;&amp; $product-&gt;is_purchasable()
         &amp;&amp; $product-&gt;is_in_stock()
         &amp;&amp; WC()-&gt;cart-&gt;find_product_in_cart( WC()-&gt;cart-&gt;generate_cart_id( $product-&gt;get_id() ) )
      ) {
   
          $text = 'Product in cart';
   
      }
   
      return $text;
   
  }
  </code></pre>
  <p>Tell me how you can change the style of the &quot;Add to Cart&quot; button for a product if the product has already been added to the cart?</p>
  <p>I tried adding code to /loop/add-to-cart.php file as shown here <a href="https://stackoverflow.com/questions/47969767/change-add-to-cart-button-style-when-product-is-in-cart-in-woocommerce">Change add to cart button style when product is in cart in Woocommerce</a> but it doesn't work for me.</p>
  <p>Are there any other code options that would help resolve my question?</p>
  <p>I will be glad for your help!</p>