woocommerce / storefront

Official theme for WooCommerce
https://wordpress.org/themes/storefront/
972 stars 471 forks source link

Fix: allow svg in storefront messages, such as notices #2133

Closed dinhtungdu closed 8 months ago

dinhtungdu commented 8 months ago

Fixes #2129

This PR fix the missing icon issue of Woo notices with Storefront theme by adding svg and its child elements to the allowed html list for wp_kses().

Alternative

Do nothing, as commented here: https://github.com/woocommerce/storefront/issues/2129#issuecomment-1891565160

Screenshots

image

How to test the changes in this Pull Request:

  1. Create a test page and add the following shortcode to it [woocommerce_cart]
  2. Go to a product page and click the Add to cart button.
  3. See that the notice “{PRODUCT}” has been added to your cart. shows an icon. ✅
  4. Go to the test page from step 1. and update the quantity of the added product.
  5. See that the notice Cart updated. shows an icon. ✅
  6. Add a coupon code to the cart.
  7. See that the notice Coupon code applied successfully. shows an icon. ✅
  8. Add the same code again.
  9. See that the notice Coupon code already applied! shows an icon. ✅
  10. Add an invalid code.
  11. See that the notice Coupon "{CODE}" does not exist! shows an icon. ✅
  12. Remove the coupon code.
  13. See that the notice Coupon has been removed. shows an icon. ✅
  14. Remove the product from the cart.
  15. See that the notice Your cart is currently empty. shows an icon. ✅
  16. See that the notice “{PRODUCT}” removed. Undo? shows an icon. ✅

Changelog

Fix – Allow SVG in Storefront messages. #1319