WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Admin\API

ProductAttributes::get_item_by_slug() public WC 1.0

Get a single attribute by it's slug.

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

No Hooks.

Return

WP_REST_Response.

Usage

$ProductAttributes = new ProductAttributes();
$ProductAttributes->get_item_by_slug( $request );
$request(WP_REST_Request) (required)
The API request.

Code of ProductAttributes::get_item_by_slug() WC 6.1.0

public function get_item_by_slug( $request ) {
	if ( empty( $request['slug'] ) ) {
		return array();
	}

	$attributes = $this->get_custom_attribute_by_slug( $request['slug'] );

	if ( is_wp_error( $attributes ) ) {
		return $attributes;
	}

	$response_items = $this->format_custom_attribute_items_for_response( $attributes );

	return reset( $response_items );
}