Skip to main content
According to wordpress documentation (https://developer.wordpress.org/reference/functions/get_terms/), the get_terms method has been changed, starting with wordpress 4.5.0. Some of the arguments has been deprecated. I've modified the answer accordingly.
Source Link

taken from that very same function:

// prior to wordpress 4.5.0
$args = array(
    'number'     => $number,
    'orderby'    => $orderby,
    'order'      => $order,
    'hide_empty' => $hide_empty,
    'include'    => $ids
);

$product_categories = get_terms( 'product_cat', $args );

// since wordpress 4.5.0
$args = array(
    'taxonomy'   => "product_cat",
    'number'     => $number,
    'orderby'    => $orderby,
    'order'      => $order,
    'hide_empty' => $hide_empty,
    'include'    => $ids
);
$product_categories = get_terms($args);

will give you the list of product categories. easy!

taken from that very same function:

$args = array(
    'number'     => $number,
    'orderby'    => $orderby,
    'order'      => $order,
    'hide_empty' => $hide_empty,
    'include'    => $ids
);

$product_categories = get_terms( 'product_cat', $args );

will give you the list of product categories. easy!

taken from that very same function:

// prior to wordpress 4.5.0
$args = array(
    'number'     => $number,
    'orderby'    => $orderby,
    'order'      => $order,
    'hide_empty' => $hide_empty,
    'include'    => $ids
);

$product_categories = get_terms( 'product_cat', $args );

// since wordpress 4.5.0
$args = array(
    'taxonomy'   => "product_cat",
    'number'     => $number,
    'orderby'    => $orderby,
    'order'      => $order,
    'hide_empty' => $hide_empty,
    'include'    => $ids
);
$product_categories = get_terms($args);

will give you the list of product categories. easy!

Source Link
Ewout
  • 2.7k
  • 1
  • 22
  • 24

taken from that very same function:

$args = array(
    'number'     => $number,
    'orderby'    => $orderby,
    'order'      => $order,
    'hide_empty' => $hide_empty,
    'include'    => $ids
);

$product_categories = get_terms( 'product_cat', $args );

will give you the list of product categories. easy!