If you are looking to remove the Add to Cart button in WooCommerce and replace it with a custom button then this short snippet is for you.

/** * Disables Add to cart button and replaced it with Read more. **/ add_filter( 'woocommerce_is_purchasable', false ); /** * Disable all except specific products */ add_filter('woocommerce_is_purchasable', 'wpharvest_is_purchasable', 10, 2); function wpharvest_is_purchasable( $is_purchasable, $object ) { // Checks to see if the product id is 22 or 23, // returns true if is, false otherwise. return ( 22 === $object->id || 23 === $object->id ); }
Code language: PHP (php)

Did you find this snippet useful? If so, or if you encountered any issues with it, please let us know in the comments section below.

Published by Dragos Micu

WooCommerce

Leave a Reply

Your email address will not be published. Required fields are marked *

hollywoodbets casino za resena casino mas cercano como jugar maquinas en casino juega gratis a atlantis en modo demo es apuestas deportivas codere sport numeros para apostar en la ruleta depsito con tarjeta de crdito en casino con eth bet 442 casino resena mejor jugada de la ruleta casino pay n play dados de apuestas con ethereum titanbet casino it resena cryptosamba casino resena giros gratis sin depsito en cripto casino jugar jungle books gratis app para jugar bingo online casino barcelona 10 euros sin deposito vulkan olimp casino resena spingenie casino se resena happyslots casino resena vegas berry casino resena 1win casino resena ro negro casino bono sin depsito 50 giros gratis 2025 historias 4 ingenieros rusos inventaron un truco para ganar en las tragaperras