Allow proceed to checkout for non mixed defined product categories in Woocommerce
问题 In woocommerce I am trying to avoid proceed to checkout when cart items are from mixed product categories… The following code is mostly working as I intended: function sv_wc_prevent_checkout_for_category() { // set the slug of the category that cannot be mixed from other categories $category = 'test'; // get the product category $product_cat = get_term_by( 'slug', $category, 'product_cat' ); // sanity check to prevent fatals if the term doesn't exist if ( is_wp_error( $product_cat ) ) {