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

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

Any method to make specific widget for every post and page?

You should be able to do what you want with the Category Country Aware (CCA) Plugin. (it’s for use within post/page content but also includes the widget below). Option 1: (only for posts and if you are happy to create one off categories): Create new categories for say “Washington” and “NY” via WP Admin Dashboard … Read more