Do not save create taxes with empty names

This commit is contained in:
Claudio Sanches 2019-07-09 15:26:07 -03:00
parent 56240c9633
commit 6c0ef10016
1 changed files with 4 additions and 0 deletions

View File

@ -763,6 +763,10 @@ class WC_Tax {
public static function create_tax_class( $name, $slug = '' ) {
global $wpdb;
if ( empty( $name ) ) {
return new WP_Error( 'tax_class_invalid_name', __( 'Tax class requires a valid name', 'woocommerce' ) );
}
$existing = self::get_tax_classes();
$existing_slugs = self::get_tax_class_slugs();