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 *

es tragamonedas invaders planet moolah trucos para ganar bingo online mejores casinos online que aceptan tarjetas de credito slot tiradas gratis juegos para el celular tragamonedas betway casino no deposit bonus casino online juegos de casino en 888casino casino online dinero real sin deposito el faraon juego de casino winning plus casino resena goldfishka casino resena casino online que convierte bitcoin a dinero real neo bet casino resena 1 colombia turbovegas 7win game casino resena 19rich casino resena es shuffle master dancing drums plazas en el mundial de clubes netent divine fortune casino sevilla donde esta sunbet ghana casino resena brasil ultra casino odds in sports betting fichas blackjack valor guia bonos sin deposito la ruleta de la suerte juego de mesa 97676 giocaonline la vecchia fattoria