Created
February 9, 2022 04:01
-
-
Save digitalchild/627cfe52166e55191417fa5d69a30c68 to your computer and use it in GitHub Desktop.
Force product type, hide tabs and show only price field on WC Vendors Product Edit Standard form.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Disable the product type drop down. | |
add_filter('wcv_disable_product_type', function() { return true; } ); | |
add_filter( 'wcv_product_meta_tabs', function() { return array(); } ); | |
// Adjust styles of the product tabs after removing them. | |
add_action('wp_head', 'wcv_add_custom_styles', 10); | |
function wcv_add_custom_styles() { | |
echo "<style>.tabs-nav { display: none!important;}</style>"; | |
} | |
/** | |
* Hook into the form and output a hidden field that sets the product type. | |
*/ | |
add_action( 'wcv_after_product_type', 'wcv_set_product_type' ); | |
function wcv_set_product_type( $object_id ){ | |
WCVendors_Pro_Product_Form::product_type_hidden( $object_id, 'appointment' ); | |
WCVendors_Pro_Product_Form::prices( $object_id ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment