Skip to content

Checkout: adding coupon codes in the checkout process causes 'Request does not match any route' error message #10035

Closed
@jhruehl

Description

@jhruehl

If one adds a coupon code starting with a hashtag '#' during the last step of the checkout process (not in the cart view itself), one gets the error message 'Request does not match any route' instead of the typical 'Coupon applied/Coupon invalid' messages.

Preconditions

  1. Magento 2.1.7
  2. PHP Version 7.0.17
  3. MySQL Version 5.6.34

Steps to reproduce

  1. Open the payment page of the checkout process, where you can add coupons (bug doesn't occur in the cart view itself)
  2. Add random coupon code starting with a hashtag '#'
  3. Click 'apply coupon'

Expected result

  1. standard success/error frontend messages 'coupon applied/invalid'.

Actual result

'Request does not match any route' error messages shown in frontend.

checkout_coupon_notice

Cause

The coupon code isn't correctly encoded in
/vendor/magento/module-checkout/view/frontend/web/js/model/resource-url-manager.js,
so before the ajax call happening the following piece of code in require.js removes the complete coupon code from the request URL:

"// Remove hash character (#7531: and string promotion)
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
// Handle falsy url in the settings object (#10093: consistency with old signature)
// We also use the url parameter if available
s.url = ( ( url || s.url || ajaxLocation ) + "" )
.replace( rhash, "" )
.replace( rprotocol, ajaxLocParts[ 1 ] + "//" );"

Patch

bugfix.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: TaxFixed 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 releasebug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions