Skip to content

Commit

Permalink
Fix bug with transliteration of WooCommerce attributes and crushing v…
Browse files Browse the repository at this point in the history
…ariations.
  • Loading branch information
kagg-design committed Feb 20, 2021
1 parent ff56ce3 commit 9b7084e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions classes/class-main.php
Expand Up @@ -196,6 +196,8 @@ protected function is_wc_attribute_taxonomy( $title ) {
return false;
}

$title = str_replace( 'pa_', '', $title );

$attribute_taxonomies = wc_get_attribute_taxonomies();

foreach ( $attribute_taxonomies as $attribute_taxonomy ) {
Expand Down
11 changes: 6 additions & 5 deletions tests/phpunit/tests/class-test-main.php
Expand Up @@ -416,10 +416,11 @@ public function dp_test_sanitize_title_for_wc_attribute_taxonomy() {
];

return [
'no wc' => [ 'color', false, null, 1 ],
'no attr taxes' => [ 'color', true, [], 1 ],
'not in attr taxes' => [ 'color', true, $attribute_taxonomies, 1 ],
'in attr taxes' => [ 'цвет', true, $attribute_taxonomies, 0 ],
'no wc' => [ 'color', false, null, 1 ],
'no attr taxes' => [ 'color', true, [], 1 ],
'not in attr taxes' => [ 'color', true, $attribute_taxonomies, 1 ],
'in attr taxes' => [ 'цвет', true, $attribute_taxonomies, 0 ],
'in attr taxes with pa_' => [ 'pa_цвет', true, $attribute_taxonomies, 0 ],
];
}

Expand Down Expand Up @@ -567,7 +568,7 @@ function ( $arg ) {
}

/**
* Data provider for test_sanitize_title
* Data provider for test_sanitize_filename
*
* @return array
*/
Expand Down

0 comments on commit 9b7084e

Please sign in to comment.