woocommerce / woocommerce-square

Square POS and Payments Integration
https://woo.com/products/square
Other
11 stars 7 forks source link

fix/30: Prevent Gift Card image from being forced upon a site #198

Closed Sidsector9 closed 2 months ago

Sidsector9 commented 3 months ago

All Submissions:


Changes proposed in this Pull Request:

Earlier, we added the default git card placeholder image to the media library on init hook. In this PR, we add to the media library when the Gift card product placeholder image setting is enabled and the settings are saved at /wp-admin/admin.php?page=wc-settings&tab=checkout&section=gift_cards_pay.

This PR also adds a provision to replace the default placeholder for gift card via the following UI:

Screenshot 2024-08-12 at 7 15 24 PM

Closes #30

Steps to test the changes in this Pull Request:

  1. Delete the gift card placeholder (the purple one shown above) from the media library.
  2. Create 2 gift card products. One with the product image set, and another without.
  3. Go to /wp-admin/admin.php?page=wc-settings&tab=checkout&section=gift_cards_pay and enable Gift card product placeholder image and save it.
  4. Observe that the gift card placeholder gets added to the media library.
  5. Observe that the gift card product created without the product image shows the purple image as the default placeholder.
  6. Repeat (3) but this time replace the default placeholder.
  7. Repeat (5) but this time observe the default placeholder is updated with whatever image you've set.
  8. Delete the current active placeholder from the media library.
  9. Observe that the setting Gift card product placeholder image automatically gets disabled.
  10. Observe that the default placeholder for the gift card product is set to the image provided by Woo Core.

Changelog entry

Fix - Prevent Gift Card image from being forced upon a site.

qasumitbagthariya commented 3 months ago

QA Update ✅


I have verified this PR in the fix/30 branch, issue has been fixed and is functioning as intended.

I tested the following on this branch:

Testing Environment

- WordPress: 6.6.1 - Theme: Storefront 4.6.0 - Theme: Twenty Twenty-Four 1.2 - WooCommerce - 9.1.4 - PHP: 8.0.30 - Web Server: Nginx 1.20.2 - Browser: Chrome - OS: macOS Ventura 13.3 - Branch: smoke-testing

https://github.com/user-attachments/assets/497f339f-3274-46cd-a7fc-f8d4d3303fd3

https://github.com/user-attachments/assets/8806bd5e-244e-455e-b533-f43088fad7cc

Steps to Test- As mentioned in the PR description. Test Results - It is working as expected. Functional Demo / Screencast - Special Notes - Ready for code review (Woo) Testing Document status: Cases related to this Issue/PR are added to the Critical Flow Wiki pages:

Sidsector9 commented 3 months ago

Makes sense @diegocurbelo 👍 I've made the changes in 358beec.