Adding icon to global attribute “Weight”
-

bvParticipant
Hello there,
I want to add an SVG icon for “Weight” global attribute, as I have icons for all others attributes?
How can I add icon for global attribute “Weight”?
Regards,
Attachments:
You must be
logged in to view attached files.
Hello,
I have checked the Weight global attribute on your site, and the SVG icon is displaying correctly now. It seems the issue has already been resolved on your side. If you still need help adding or replacing the icon, feel free to let me know.
See screenshot for clarification: https://postimg.cc/QKZhY07g
Best Regards,

bvParticipant
Hello,
Yes – I have found the solution by adding this piece of code inside functions.php file of a child theme.
// ikonica za weight atribut
add_filter( 'woocommerce_display_product_attributes', 'mp_add_weight_icon_attribute' );
function mp_add_weight_icon_attribute( $attributes ) {
// Ako postoji weight atribut, dodamo HTML ikonicu
if ( isset( $attributes['weight'] ) ) {
$icon_url = '/wp-content/uploads/2025/12/tezina.svg';
// Upisujemo custom HTML u label
$attributes['weight']['label'] = '
<span class="wd-attr-name">
<img
src="/wp-content/themes/woodmart/images/lazy.svg"
data-src="' . esc_url( $icon_url ) . '"
class="wd-lazy-fade wd-attr-name-img"
width="150" height="150"
alt="Težina"
loading="lazy"
/>
<span class="wd-attr-name-label">Težina</span>
<span class="wd-hint wd-tooltip">Ukupna težina proizvoda</span>
</span>
';
}
return $attributes;
}
Is there any better or easier solution from your side?
Regards
Hello,
Yes, your method works fine, and it’s safe to use since you added it inside the child theme. At the moment, WoodMart does not provide a built-in option to upload a custom SVG icon for individual global attributes.
Best Regards,