Skip to content

Instantly share code, notes, and snippets.

@digitalchild
Created February 9, 2022 04:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digitalchild/627cfe52166e55191417fa5d69a30c68 to your computer and use it in GitHub Desktop.
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.
<?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