Skip to content

Trim whitespace on SKU when saving product #16572

Closed
@Zyles

Description

@Zyles

Preconditions

Magento 2.2

Steps to reproduce

Save or update product in admin with a space at beginning or end.

Expected result

Trim excessive whitespace at beginning and end of SKU

Actual result

Whitespace SKU saved in DB.

The actual problem

When you accidentally save a product with whitespaced SKUs it can become a future problem when syncing data, importing images, or any other process because the SKU was correct but a space was accidentally added.

When doing syncing you could end up with duplicate products with good inventory systems that actually trim the SKU.

The GUI text field itself is padded which can lead to store managers not noticing an accidental extra space.

Is there an applicable real world reason for a space at the beginning of an SKU (and the end)? Why is it allowed?

Metadata

Metadata

Labels

Component: CatalogEvent: squashtoberfestFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releasegood first issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions