diff --git a/includes/admin/meta-boxes/class-wc-meta-box-product-data.php b/includes/admin/meta-boxes/class-wc-meta-box-product-data.php index c79d43d6b3d..fafb3886a28 100644 --- a/includes/admin/meta-boxes/class-wc-meta-box-product-data.php +++ b/includes/admin/meta-boxes/class-wc-meta-box-product-data.php @@ -643,7 +643,8 @@ class WC_Meta_Box_Product_Data { $options = wc_get_text_attributes( $attribute['value'] ); foreach ( $options as $option ) { - echo ''; + $selected = sanitize_title( $variation_selected_value ) === $variation_selected_value ? selected( sanitize_title( $variation_selected_value ), sanitize_title( $option ), false ) : selected( $variation_selected_value, $option, false ); + echo ''; } } diff --git a/includes/admin/meta-boxes/views/html-variation-admin.php b/includes/admin/meta-boxes/views/html-variation-admin.php index 81930c2b54f..7f4efb1552e 100644 --- a/includes/admin/meta-boxes/views/html-variation-admin.php +++ b/includes/admin/meta-boxes/views/html-variation-admin.php @@ -45,7 +45,8 @@ extract( $variation_data ); $options = wc_get_text_attributes( $attribute['value'] ); foreach ( $options as $option ) { - echo ''; + $selected = sanitize_title( $variation_selected_value ) === $variation_selected_value ? selected( sanitize_title( $variation_selected_value ), sanitize_title( $option ), false ) : selected( $variation_selected_value, $option, false ); + echo ''; } } diff --git a/templates/single-product/add-to-cart/variable.php b/templates/single-product/add-to-cart/variable.php index 017e7b370db..ffe01f01ec8 100644 --- a/templates/single-product/add-to-cart/variable.php +++ b/templates/single-product/add-to-cart/variable.php @@ -53,7 +53,8 @@ global $product, $post; } else { foreach ( $options as $option ) { - echo ''; + $selected = sanitize_title( $selected_value ) === $selected_value ? selected( sanitize_title( $selected_value ), sanitize_title( $option ), false ) : selected( $selected_value, $option, false ); + echo ''; } } }