woocommerce function for addming product size code example
Example 1: auto images size of woocommerce products
@media (min-width: 768px) {
.inside-wc-product-image {
width: 100%;
}
.woocommerce ul.products li.product a img {
height: 200px;
object-fit: cover;
}
}
Example 2: woo commerce print size and weight on product page
add_action ('woocommerce_single_product_summary', 'show_weight', 20);
function show_weight() {
global $product;
$weight_unit = get_option('woocommerce_weight_unit');
$attributes = $product->get_attributes();
if ( $product->has_weight() ) {
print '<p>Weight: '.$product->get_weight(). $weight_unit . '</p>'.PHP_EOL;
}
}