Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Now setting the discount code ID on orders before saving #3190

Conversation

dparker1005
Copy link
Member

All Submissions:

Changes proposed in this Pull Request:

Currently, discount codes are set for orders after the orders have been saved. This means that the discount code attributes are not correct during the pmpro_added_order hook and the pmpro_updated_order hook.

This PR updates the logic when saving orders at checkout and on the Edit Order page to set the discount code during the order save process to make sure that those actions work as expected.

Note: When using offiste gateways (such as Stripe Checkout or PayPal Express), the discount code will still not be available during the pmpro_added_order hook. This is because the order is initially added in token status and is later updated to success with the discount code added once the checkout is complete. In these cases, it is best to use the pmpro_after_checkout or pmpro_order_status_success hooks.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you successfully run tests with your changes locally?

Changelog entry

Enter a summary of all changes on this Pull Request. This will appear in the changelog if accepted.

@ideadude
Copy link
Member

Looks good to ship.

@dparker1005 dparker1005 merged commit a688aa9 into strangerstudios:dev Nov 20, 2024
@dparker1005 dparker1005 deleted the set-discount-code-id-on-order-before-save branch November 21, 2024 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants