add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' ); function woo_add_custom_general_fields() { global $woocommerce, $post; echo '
'; } // Save Fields add_action( 'woocommerce_process_product_meta', 'woo_add_custom_general_fields_save' ); function woo_add_custom_general_fields_save( $post_id ){ // Checkbox $woocommerce_checkbox = isset( $_POST['_no_free_shipping_checkbox'] ) ? 'yes' : 'no'; update_post_meta( $post_id, '_no_free_shipping_checkbox', $woocommerce_checkbox ); $woocommerce_product_checkbox = isset( $_POST['_discontinued_product_checkbox'] ) ? 'yes' : 'no'; update_post_meta( $post_id, '_discontinued_product_checkbox', $woocommerce_product_checkbox ); $woocommerce_custom_product_checkbox = isset( $_POST['_custom_product'] ) ? 'yes' : 'no'; update_post_meta( $post_id, '_custom_product', $woocommerce_custom_product_checkbox ); } add_filter('woocommerce_is_purchasable', 'ar_custom_is_purchasable', 10, 2); function ar_custom_is_purchasable( $is_purchasable, $object ) { // get the product id first $product_id = $object->get_id(); // get the product meta data $is_custom = get_post_meta($product_id, '_custom_product', true); if ($is_custom == "yes"){ return false; } else { return true; } } add_action( 'woocommerce_single_product_summary', 'ar_custom_product_cta', 60); function ar_custom_product_cta() { global $product; // get the product id first $product_id = $product->get_id(); // get the product meta data $is_custom = get_post_meta($product_id, '_custom_product', true); // Show the Form if product is Custom if ($is_custom == "yes"){ echo '