Skip to main content
edited tags
Link
fuxia
  • 107.3k
  • 39
  • 256
  • 463
Source Link
Oscar S.
  • 19
  • 1
  • 1
  • 3

Woocommerce: Variable Product - get variation name

I want to get the Woocommerce variable product variation name. If, for example, I have a product that is available in different sizes: small, medium and large. Then I would like to print for example "large". I have almost got it to work. The problem is, I also get the product name at the same time like: "Product name - Large" Here is my code:

$product_variation = wc_get_product($variation['variation_id']); $product_variation->get_name()

Hope someone can help, thanks. :-)