wc-smooth-generator
wc-smooth-generator copied to clipboard
Add Order Attribution support.
All Submissions:
- [ ] Have you followed the Contributing guidelines?
- [ ] Does your code follow the WordPress' coding standards?
- [ ] Have you checked to ensure there aren't other open Pull Requests for the same update/change?
Changes proposed in this Pull Request:
Closes #128 .
How to test the changes in this Pull Request:
- Create an order using the Generator.
- Go to the order in WC admin.
- Check that the Order Attribution metabox has values.
Other information:
- [ ] Have you added an explanation of what your changes do and why you'd like us to include them?
- [ ] Have you written new tests for your changes, as applicable?
- [ ] 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.
- Add - Order Attribution support.
FOR PR REVIEWER ONLY:
- [ ] I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.
@layoutd
I initially wanted to just go with rand but the rest of the codebase wp_rand so I have reverted to that.
According to the documentation random_int should be used in case you want to have some level of cryptographic security which is not necessary here.
Other small changes:
- a flag that allows skipping order attribution generation has been added
- orders created before the 8.5 release will not have order attribution data
@layoutd I have update the logic for the Web Admin and Direct cases - it was worth adding it for consistency.
Please review the updates.