Answer the question
In order to leave comments, you need to log in
How to hide certain attributes only in the product catalog?
Is it possible to hide some attributes only in the product catalog? Suppose I need to display only the size and material in the catalog, and +8 more attributes inside on the product page? It's just that now there is an opportunity to hide attributes with a function
function devise_hide_attributes_from_additional_info_tabs( $attributes, $product ) {
$hidden_attributes = [
'pa_network',
'pa_merchant',
'pa_brand',
];
foreach ( $hidden_attributes as $hidden_attribute ) {
if ( ! isset( $attributes[ $hidden_attribute ] ) ) {
continue;
}
$attribute = $attributes[ $hidden_attribute ];
$attribute->set_visible( false );
}
return $attributes;
}
add_filter( 'woocommerce_product_get_attributes', 'devise_hide_attributes_from_additional_info_tabs', 20, 2 );
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question