Skip to content

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

Open

Description

@zackkatz

Description

The "edit discount code" link on the Sitewide Sale edit page is broken — clicking it results in errors instead of opening the EDD discount editor.

Root Cause

The URL uses edd-action=edit_discount, which triggers EDD's discount save/update handler (requiring nonce validation). The correct parameter for loading the edit screen is view=edit_discount.

Affected code: modules/ecommerce/edd/class-swsales-module-edd.php (line 143) and modules/ecommerce/edd/swsales-module-edd-metaboxes.js (line 14).

Steps to Reproduce

  1. Create or edit a Sitewide Sale with the EDD sale type
  2. Select an existing EDD discount code
  3. Click the "edit discount code" button
  4. Result: EDD shows an error or redirect loop

Expected Behavior

The "edit discount code" link should open the EDD discount edit page.

Fix

Replace edd-action=edit_discount with view=edit_discount in both PHP and JS. See PR #184.

Activity

  1. added 6 commits that reference this issue on Mar 5, 2026
    b81111c
    e3c87ce
    d175478
    040dd11
    f2244ec
    70775e2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions