Skip to content

Fix 'Invalid nonce' error on EDD edit discount code link - #184

Open
zackkatz wants to merge 1 commit into
strangerstudios:devfrom
GravityKit:fix/edd-edit-discount-nonce
Open

Fix 'Invalid nonce' error on EDD edit discount code link#184
zackkatz wants to merge 1 commit into
strangerstudios:devfrom
GravityKit:fix/edd-edit-discount-nonce

Conversation

@zackkatz

@zackkatz zackkatz commented Mar 5, 2026

Copy link
Copy Markdown

Summary

  • The "edit discount code" link on the Sitewide Sale edit page used edd-action=edit_discount, which triggers EDD's discount save handler and requires nonce validation
  • The correct URL parameter for viewing the edit screen is view=edit_discount, which simply loads the editor without requiring a nonce
  • Fixed in both the PHP template (server-rendered link) and the JavaScript (dynamically-updated link when changing the dropdown)

Fixes #183

Test plan

  • Create or edit a Sitewide Sale with EDD sale type
  • Select an existing EDD discount code
  • Click the "edit discount code" link — should open EDD discount edit page
  • Change the selected discount code in the dropdown, then click "edit discount code" — the dynamically-updated link should also work

@zackkatz
zackkatz force-pushed the fix/edd-edit-discount-nonce branch 2 times, most recently from e3c87ce to d175478 Compare March 5, 2026 01:43
@zackkatz
zackkatz force-pushed the fix/edd-edit-discount-nonce branch from 040dd11 to d175478 Compare March 5, 2026 01:51
The edit discount URL used edd-action=edit_discount which is the legacy
format. EDD 3.x uses view=edit_discount instead, causing a nonce error
with the old URL format.

Fixes strangerstudios#183
@zackkatz
zackkatz force-pushed the fix/edd-edit-discount-nonce branch from d175478 to 70775e2 Compare March 5, 2026 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EDD 'edit discount code' link generates 'Invalid nonce' error

1 participant