Code Duplication    Length = 12-13 lines in 2 locations

includes/class-wc-product-variable.php 1 location

@@ 705-716 (lines=12) @@
702
						continue;
703
					}
704
					if ( sanitize_title( $value[0] ) === $value[0] ) {
705
						foreach ( $parent_attributes as $attribute ) {
706
							if ( $name !== 'attribute_' . sanitize_title( $attribute['name'] ) ) {
707
								continue;
708
							}
709
							$text_attributes = wc_get_text_attributes( $attribute['value'] );
710
							foreach ( $text_attributes as $text_attribute ) {
711
								if ( sanitize_title( $text_attribute ) === $value[0] ) {
712
									update_post_meta( $child_id, $name, $text_attribute );
713
									break;
714
								}
715
							}
716
						}
717
					}
718
				}
719
			}

includes/wc-product-functions.php 1 location

@@ 669-681 (lines=13) @@
666
		 * Attempt to get full version of the text attribute from the parent.
667
		 */
668
		if ( sanitize_title( $value[0] ) === $value[0] && version_compare( get_post_meta( $parent_id, '_product_version', true ), '2.4.0', '<' ) ) {
669
			foreach ( $parent_attributes as $attribute ) {
670
				if ( $name !== 'attribute_' . sanitize_title( $attribute['name'] ) ) {
671
					continue;
672
				}
673
				$text_attributes = wc_get_text_attributes( $attribute['value'] );
674
675
				foreach ( $text_attributes as $text_attribute ) {
676
					if ( sanitize_title( $text_attribute ) === $value[0] ) {
677
						$value[0] = $text_attribute;
678
						break;
679
					}
680
				}
681
			}
682
		}
683
684
		$variation_attributes[ $name ] = $value[0];