diff --git a/includes/Api/ProductsController.php b/includes/Api/ProductsController.php index d391db6..472be24 100644 --- a/includes/Api/ProductsController.php +++ b/includes/Api/ProductsController.php @@ -599,10 +599,6 @@ class ProductsController { // Format attributes with human-readable names and values $formatted_attributes = []; - // Debug: Log all meta for this variation - $all_meta = get_post_meta($variation_id); - error_log("Variation #{$variation_id} ALL META: " . print_r($all_meta, true)); - // Get parent product attributes to know what to look for $parent_attributes = $product->get_attributes(); @@ -626,17 +622,10 @@ class ProductsController { $value = $term ? $term->name : $value; } } else { - // Custom attribute - get the value from variation meta - // WooCommerce stores it as 'attribute_' + lowercase attribute name - $meta_key = 'attribute_' . strtolower($attr_name); + // Custom attribute - WooCommerce stores as 'attribute_' + exact attribute name + $meta_key = 'attribute_' . $attr_name; $value = get_post_meta($variation_id, $meta_key, true); - // If not found, try with sanitized title - if (empty($value)) { - $meta_key = 'attribute_' . sanitize_title($attr_name); - $value = get_post_meta($variation_id, $meta_key, true); - } - // Capitalize the attribute name for display $clean_name = ucfirst($attr_name); }