WordPress at a glance
function is not described

WC_API_Products::get_product_tags() public WC 2.5.0

Get a listing of product tags.

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

Return

Array|WP_Error.

Usage

$WC_API_Products = new WC_API_Products();
$WC_API_Products->get_product_tags( $fields );
$fields(string|null)
Fields to limit response to

Changelog

Since 2.5.0 Introduced.

Code of WC_API_Products::get_product_tags() WC 5.0.0

<?php
public function get_product_tags( $fields = null ) {
	try {
		// Permissions check
		if ( ! current_user_can( 'manage_product_terms' ) ) {
			throw new WC_API_Exception( 'woocommerce_api_user_cannot_read_product_tags', __( 'You do not have permission to read product tags', 'woocommerce' ), 401 );
		}

		$product_tags = array();

		$terms = get_terms( 'product_tag', array( 'hide_empty' => false, 'fields' => 'ids' ) );

		foreach ( $terms as $term_id ) {
			$product_tags[] = current( $this->get_product_tag( $term_id, $fields ) );
		}

		return array( 'product_tags' => apply_filters( 'woocommerce_api_product_tags_response', $product_tags, $terms, $fields, $this ) );
	} catch ( WC_API_Exception $e ) {
		return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
	}
}