wp php get product attribute name without pa

  1. Access the product object:
$product = wc_get_product( $product_id );
  1. Get the product attributes:
$attributes = $product->get_attributes();
  1. Iterate through the attributes:
foreach ( $attributes as $attribute ) {
  1. Check if the attribute is not a variation attribute ('pa_' prefix):
    if ( 0 !== strpos( $attribute['name'], 'pa_' ) ) {
  1. Get the attribute name:
        $attribute_name = wc_attribute_label( $attribute['name'] );
  1. Output or use the attribute name as needed:
        echo $attribute_name;
    }
}