Skip to content

Checkout: Whitespace in front of coupon code causes "Coupon code is not valid" #12656

@AndrewPenry

Description

@AndrewPenry

Preconditions

  1. Magento 2.1.10 with Sample Data
  2. PHP Version 7.0.22

Steps to reproduce

  1. Open checkout page and complete up to Payment step
  2. Fill in a coupon code with leading whitespace, like " H20"
  3. Click "Apply Discount"

Expected result

  1. The Discount should be applied

Actual result

  1. "Coupon code is not valid"
  2. In the logs: PUT /rest/default/V1/guest-carts/64610d8402c5f9e919929442220967ca/coupons/%20H20 HTTP/1.1

Note that whitespace after the coupon code is not being encoded in the PUT string, so the coupon works with trailing whitespace, just not with leading whitespace.

Metadata

Metadata

Assignees

Labels

Fixed in 2.2.xThe issue has been fixed in 2.2 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.1.xThe issue has been reproduced on latest 2.1 releaseReproduced 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 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions