Add a Delete Category field to Product > Edit
Thanks to the author Rodolfo Melogli at CustomizeWoo.com
Add this to functions.php
/**
* @snippet Bulk Remove Product Categories @ WooCommerce Products Admin
* @Thanks to how-to Get CustomizeWoo.com FREE
* @author Rodolfo Melogli
* @compatible WooCommerce 8
* @community https://businessbloomer.com/club/
*/
add_action( ‘woocommerce_product_bulk_edit_start’, ‘bbloomer_bulk_edit_remove_product_category’ );
function bbloomer_bulk_edit_remove_product_category() {
?>
<div class=”inline-edit-group”>
<label class=”alignleft”>
<span class=”title”>Delete Cat</span>
<span class=”input-text-wrap”>
<?php wc_product_dropdown_categories( [ ‘class’ => ‘remove_product_cat’, ‘name’ => ‘remove_product_cat’, ‘show_option_none’ => ‘Select product category to be removed’, ‘value_field’ => ‘term_id’ ] ); ?>
</span>
</label>
</div>
<?php
}
add_action( ‘woocommerce_product_bulk_edit_save’, ‘bbloomer_bulk_edit_remove_product_category_save’, 9999 );
function bbloomer_bulk_edit_remove_product_category_save( $product ) {
$post_id = $product->get_id();
if ( isset( $_REQUEST[‘remove_product_cat’] ) ) {
$cat_to_remove = $_REQUEST[‘remove_product_cat’];
$categories = $product->get_category_ids();
if ( ! in_array( $cat_to_remove, $categories ) ) return;
if ( ( $key = array_search( $cat_to_remove, $categories ) ) !== false ) {
unset( $categories[$key] );
}
$product->set_category_ids( $categories );
$product->save();
}
}
Add CSS only on the Shop page
change .xxx to the specific CSS element you want to change
.archive.post-type-archive-product.woocommerce .xxx {
background-color: pink;
}
Increase Your PHP Memory
Add this to wp-config.php
// Increase PHP Memory as recommended by Woocommerce
define( ‘WP_MEMORY_LIMIT’, ’64M’ );
Move WooCommerce Product Tabs under Product Summary
Add this to functions.php
// Remove tabs from the original location
remove_action( ‘woocommerce_after_single_product_summary’, ‘woocommerce_output_product_data_tabs’, 10 );
// Insert tabs under Product Summary
add_action( ‘woocommerce_single_product_summary’, ‘woocommerce_output_product_data_tabs’, 60 );
Remove sidebar from Woocommerce
Remove this from wp-content/plugins/woocommerce/single-product.php
<?php
/**
* woocommerce_sidebar hook
* @hooked woocommerce_get_sidebar – 10
*/
do_action(‘woocommerce_sidebar’);
?>
Remove this from wp-content/plugins/woocommerce/archive-product.php
<?php
/**
* woocommerce_sidebar hook
* @hooked woocommerce_get_sidebar – 10
*/
do_action(‘woocommerce_sidebar’);
?>
Add this to style.css
#content-woocommerce {
width:100%;
}
Change the number of Woocommerce related products and columns
Add this to functions.php
<?php
/**
* Change number of related products on product page
* Set your own value for ‘posts_per_page’
*/
function woo_related_products_limit() {
global $product;
$args[‘posts_per_page’] = 6;
return $args;
}
add_filter( ‘woocommerce_output_related_products_args’, ‘jk_related_products_args’ );
function jk_related_products_args( $args ) {
$args[‘posts_per_page’] = 3; // 3 related products
$args[‘columns’] = 3; // arranged in 3 columns
return $args;
}
Remove Woocommerce checkout fields
Add this to functions.php
Turn fields to visibility on by removing //
// Woo remove checkout fields
add_filter( ‘woocommerce_checkout_fields’, ‘remove_woo_fields’, 9999 );
Require Woocommerce checkout fields
Add this to functions.php
// Woo required checkout fields
Field names for Woocommerce checkout
billing_first_name
billing_last_name
billing_company
billing_country
billing_address_1
billing_address_2
billing_city
billing_state
billing_postcode
billing_phone
billing_email
Shipping Fields
shipping_first_name
shipping_last_name
shipping_company
shipping_country
shipping_address_1
shipping_address_2
shipping_city
shipping_state
shipping_postcode
Order Fields
order_comments