having a bit of trouble with WooCommerce, basically on the store I am working on there will need to be an option to display a "Call to Order" message instead of showing the default "Add to Cart" form or "Sold Out" message.
I have kind of achieved this by adding a custom metabox checkbox in the product edit back-end, and an if statement in the single product add to cart template, the only problem is all this does is hide the add to cart form and the product can still be added like so "http://localhost/wordpress/woocommerce/shop/?add-to-cart=14" so its not exactly full-proof.
What I am looking for is to somehow make the product out of stock when the custom checkbox is checked, I was looking in the WooCommerce plugin admin back-end files and this is used a lot:
update_post_meta( $post_id, '_stock_status', 'outofstock' );
So I thought it would be as easy this in functons.php:
global $post;
if ($meta_box = get_post_meta($post->ID, "_cmb_test_checkbox", true) ) :
update_post_meta( $post_id, '_stock_status', 'outofstock' );
endif;
Turns out its not. Any help would be greatly appreciated as this is driving me crazy.
Cheers!