Catch Themes » All Posts https://catchthemes.com/support-forum/forum/full-site-editing/fotografie-blocks/feed/ Tue, 07 Oct 2025 00:40:00 +0000 https://bbpress.org/?v=2.6.14 en-US https://catchthemes.com/support-forum/topic/display-product-attributes-on-product-pages/#post-341167 <![CDATA[Reply To: display product attributes on product pages]]> https://catchthemes.com/support-forum/topic/display-product-attributes-on-product-pages/#post-341167 Mon, 08 Sep 2025 07:39:23 +0000 sujeet Hello Alex,

Try to add the following code instead.

add_action('woocommerce_product_meta_end', 'su_filterable_attributes_inline');

function su_filterable_attributes_inline()
{
if (! function_exists('wc_get_page_permalink')) return;

global $product;
if (! $product) return;

$attributes = $product->get_attributes();
if (empty($attributes)) return;

$shop_url = wc_get_page_permalink('shop');
if (! $shop_url) return;

echo '<span class="custom-product-attributes">';

foreach ($attributes as $attribute) {
if (! $attribute->get_visible()) continue;

if ($attribute->is_taxonomy()) {
$taxonomy = $attribute->get_name();
$label = wc_attribute_label($taxonomy);
$base_slug = sanitize_title(str_replace('pa_', '', $taxonomy));
$filter_key = 'filter_' . $base_slug;

$terms = wc_get_product_terms($product->get_id(), $taxonomy, array('fields' => 'all'));
if (empty($terms)) continue;

$links = array();
foreach ($terms as $term) {
$url = add_query_arg(
array(
$filter_key => $term->slug,
'query_type_' . $base_slug => 'or',
),
$shop_url
);
$links[] = '<a class="attr-chip attr-chip--' . esc_attr($term->slug) . '" href="' . esc_url($url) . '">' . esc_html($term->name) . '</a>';
}

echo '<span class="product-attr"><strong>' . esc_html($label) . ':</strong> ' . implode(', ', $links) . '</span> <br>';
} else {

$label = wc_attribute_label($attribute->get_name());
$value = implode(', ', $attribute->get_options());
echo '<span class="product-attr"><strong>' . esc_html($label) . ':</strong> ' . esc_html($value) . '</span> ';
}
}

echo '</span>';
}

And you can try using ‘All-in-One WP Migration and Backup’ plugin to transfter the theme. That may help.

Please let me know if this worked. Thank you.

Regards,
Sujeet

]]>