Category: WooCommerce
What is the API for additional fields in WooCommerce?

19.04.2025
1 min read
php
// Get a product object
$product = wc_get_product($product_id);
// Method 1: Using WooCommerce’s object-oriented approach
$value = $product->get_meta(‘custom_field_name’);
// Method 2: Using WordPress core functions
$value = get_post_meta($product_id, ‘custom_field_name’, true);