From 687e51654b9288803c4c1f31371f90702891b2fb Mon Sep 17 00:00:00 2001 From: Dwindi Ramadhana Date: Thu, 8 Jan 2026 09:19:08 +0700 Subject: [PATCH] fix(api): normalize custom attribute meta key to lowercase WooCommerce stores variation custom attribute meta keys in lowercase (e.g., attribute_size), but we were using the original case from parent attributes (e.g., attribute_Size). This caused empty attribute values in the admin Order Form variation selector. Fix: Use sanitize_title() to normalize the attribute name. --- includes/Api/OrdersController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/Api/OrdersController.php b/includes/Api/OrdersController.php index 52b2d81..3b770ca 100644 --- a/includes/Api/OrdersController.php +++ b/includes/Api/OrdersController.php @@ -1295,8 +1295,8 @@ class OrdersController { $value = $term ? $term->name : $value; } } else { - // Custom attribute - WooCommerce stores as 'attribute_' + exact attribute name - $meta_key = 'attribute_' . $attr_name; + // Custom attribute - WooCommerce stores as 'attribute_' + lowercase sanitized name + $meta_key = 'attribute_' . sanitize_title( $attr_name ); $value = get_post_meta( $variation_id, $meta_key, true ); // Capitalize the attribute name for display