Reputation: 509
I work on small business site, and have a hard time to remove weight from product backend, and also from single product page into "Additional Informations" page. I tryed all "working" solutions that I found on web like Remove product dimensions from single product pages in Woocommerce answer code and this code too:
add_filter( 'woocommerce_product_get_weight' , '__return_false' );
But it seems like that not makes any changes. For better to explain what I need to remove:
Tryed also with CSS:
.tabs-layout-tabs #tab-additional_information .shop_attributes
{
display:none;
}
But this remove all data from the tab. Any help?
Upvotes: 0
Views: 1313
Reputation: 254212
The following will hide weight field from product backend shipping setting section:
add_action( 'woocommerce_product_options_general_product_data', 'hide_weight_field_from_product_shipping_setting_section', 100 );
function hide_weight_field_from_product_shipping_setting_section() {
?>
<style>
p.form-field._weight_field {
display:none;
}
</style>
<?php
}
Now for frontend single product pages, the code below (like in your question) works on last WooCommerce version, removing weight row from "Additional information" tab:
add_filter( 'woocommerce_product_get_weight' , '__return_false' );
Code goes in functions.php file of your active child theme (or active theme). Tested and works.
Upvotes: 1