Hide ‘add to cart’ button for some products [duplicate]

I don’t know whether my solution is perfect. But it works. Normally if is_purchasable is returned to the filter woocommerce_is_purchasable, the ‘Add to Cart’ button is displayed, and if false is returned the button is hidden. So, you just need to add the following: add_filter(‘woocommerce_is_purchasable’, ‘my_woocommerce_is_purchasable’, 10, 2); function my_woocommerce_is_purchasable($is_purchasable, $product) { // Write code … Read more

Help on Wp_query to print an term

If you want to output/print the term name look at this within the loop: https://developer.wordpress.org/reference/functions/get_the_terms/ $terms = get_the_terms( get_the_ID(), ‘pwb-brand’ ); You will need to output within the loop similar to this: <?php $loop = new WP_Query( $args ); if ( $loop->have_posts() ) { while ( $loop->have_posts() ) : $loop->the_post(); $terms = get_the_terms( get_the_ID(), ‘pwb-brand’ … Read more

cancel place order proccess

You can just return false to the ajax call thereby blocking the call. The below code is Tested . . And it’s working. Let me know if there is any issues. $( ‘form.checkout’ ).on( ‘checkout_place_order’, function() { alert( ‘submit cancelled!’ ); return false; });

Echo custom admin field into a is_single()

$postids = get_option(‘codeable_posts_field’); This will give you a string of comma separated post ids (according to your code, and if the user follows the instructions). array( $postids ) will turn it into an array with that string as the only element. That won’t work with is_single(), obviously, because is_single doesn’t do any further splitting. Here’s … Read more