wc-smooth-generator icon indicating copy to clipboard operation
wc-smooth-generator copied to clipboard

Add Order Attribution support.

Open budzanowski opened this issue 1 year ago • 2 comments

All Submissions:

Changes proposed in this Pull Request:

Closes #128 .

How to test the changes in this Pull Request:

  1. Create an order using the Generator.
  2. Go to the order in WC admin.
  3. 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.

budzanowski avatar Jan 19 '24 09:01 budzanowski

@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

budzanowski avatar Jan 20 '24 12:01 budzanowski

@layoutd I have update the logic for the Web Admin and Direct cases - it was worth adding it for consistency.

Please review the updates.

budzanowski avatar Feb 09 '24 09:02 budzanowski