WordPress at a glance
function is not described

Automattic\WooCommerce\Admin\API

ProductAttributeTerms::get_custom_attribute_values() protected WC 1.0

Query custom attribute values by slug.

{} It's a method of the class: ProductAttributeTerms{}

No Hooks.

Return

Array. Attribute values, formatted for response.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_custom_attribute_values( $slug );
$slug(string) (required)
Attribute slug.

Code of ProductAttributeTerms::get_custom_attribute_values() WC 5.3.0

<?php
protected function get_custom_attribute_values( $slug ) {
	global $wpdb;

	if ( empty( $slug ) ) {
		return array();
	}

	// Find all attribute values assigned to products.
	$query_results = $wpdb->get_results(
		$wpdb->prepare(
			"SELECT meta_value, COUNT(meta_id) AS product_count
			FROM {$wpdb->postmeta}
			WHERE meta_key = %s
			GROUP BY meta_value",
			'attribute_' . esc_sql( $slug )
		),
		ARRAY_A
	);

	$attribute_values = array();

	foreach ( $query_results as $term ) {
		// Mimic the structure of a taxonomy-backed attribute values for response.
		$data = array(
			'id'          => $term['meta_value'],
			'name'        => $term['meta_value'],
			'slug'        => $term['meta_value'],
			'description' => '',
			'menu_order'  => 0,
			'count'       => (int) $term['product_count'],
		);

		$response = rest_ensure_response( $data );
		$response->add_links(
			array(
				'collection' => array(
					'href' => rest_url(
						$this->namespace . '/products/attributes/' . $slug . '/terms'
					),
				),
			)
		);
		$response = $this->prepare_response_for_collection( $response );

		$attribute_values[] = $response;
	}

	return $attribute_values;
}