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

Fix coupon codes containing apostrophes #40998

Merged
merged 7 commits into from Feb 13, 2024

Conversation

mikejolley
Copy link
Member

@mikejolley mikejolley commented Oct 25, 2023

Submission Review Guidelines:

Changes proposed in this Pull Request:

Updates the wc_sanitize_coupon_code function to allow the ' character. I have included a additional test to cover this case, and I fixed a notice I encountered while testing which prevented me applying coupons (PHP8 notice due to a missing variable).

Closes #39481

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. Add a coupon called test's. Any value is fine.
  2. After saving the coupon, the coupon code test's should be visible in the coupon table. It should not be test\'s.
  3. Go to cart on the frontend. Confirm the test's coupon can be applied to the cart. Place the order and ensure the coupon continues to function correctly.

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Fixed coupon errors with coupon codes containing apostrophes.

Comment

@mikejolley mikejolley self-assigned this Oct 25, 2023
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Oct 25, 2023
@mikejolley mikejolley added type: bug The issue is a confirmed bug. focus: cart Issues related to the cart. focus: coupon Issues related to coupons. team: Rubik labels Oct 25, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Oct 25, 2023

Test Results Summary

Commit SHA: c9605fd

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 37s
E2E Tests31700403217m 8s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

@opr opr closed this Nov 1, 2023
@opr opr reopened this Nov 1, 2023
@opr opr closed this Nov 1, 2023
@opr opr reopened this Nov 1, 2023
opr
opr previously approved these changes Nov 1, 2023
Copy link
Contributor

@opr opr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and works well, thanks!

@opr opr dismissed their stale review November 1, 2023 12:48

Tests failing

@opr
Copy link
Contributor

opr commented Nov 3, 2023

@mikejolley I can't get the tests working locally on this to debug, but I dismissed my review based on that.

@mikejolley mikejolley force-pushed the fix/coupon-title-sanitization-39481 branch from d296064 to 8efa7d1 Compare December 15, 2023 13:38
@mikejolley mikejolley force-pushed the fix/coupon-title-sanitization-39481 branch from 98a24e1 to a92cd0b Compare January 25, 2024 13:13
@mikejolley mikejolley requested a review from opr February 9, 2024 11:18
Copy link
Contributor

github-actions bot commented Feb 9, 2024

Hi @opr,

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

Copy link
Contributor

@opr opr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, tests OK. Clarified that wp_kses adds slashes unless you've got the unfiltered_html which is why we're removing them specifically for users without that capability.

Thanks Mike!

@mikejolley mikejolley force-pushed the fix/coupon-title-sanitization-39481 branch from 95ec4fa to c9605fd Compare February 13, 2024 16:27
@mikejolley mikejolley merged commit cea1c10 into trunk Feb 13, 2024
34 of 35 checks passed
@mikejolley mikejolley deleted the fix/coupon-title-sanitization-39481 branch February 13, 2024 17:01
@github-actions github-actions bot added this to the 8.7.0 milestone Feb 13, 2024
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label Feb 13, 2024
@Stojdza Stojdza added needs: internal testing Indicates if the PR requires further testing conducted by Solaris status: analysis complete Indicates if a PR has been analysed by Solaris and removed needs: analysis Indicates if the PR requires a PR testing scrub session. labels Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: cart Issues related to the cart. focus: coupon Issues related to coupons. needs: internal testing Indicates if the PR requires further testing conducted by Solaris plugin: woocommerce Issues related to the WooCommerce Core plugin. status: analysis complete Indicates if a PR has been analysed by Solaris team: Rubik type: bug The issue is a confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Coupon Codes: Apostrophes Causing Errors
3 participants