Skip to content

Conversation

@laurelfulford
Copy link
Contributor

@laurelfulford laurelfulford commented Jun 10, 2025

All Submissions:

Changes proposed in this Pull Request:

This PR adds a 'Allow to be gifted' checkbox to products when:

  • They are a subscription or variable subscription product
  • When WooCommerce Subscriptions Gifting is installed and enabled, and
  • When 'Limit Subscription' is set to 'Do not limit'.

This checkbox is disabled by default, so all subscription products will not be considered 'giftable' by default.

This allows us to set up some more nuanced subscription gifting that works with our own subscription limitations (one per customer), and that won't clash with existing products.

See NPPM-385.

How to test the changes in this Pull Request:

  1. Apply this PR and run npm run build.
  2. Make sure you have Woo Subscriptions and Woo Subscriptions Gifting installed and activated on your site.
  3. Create a new product. Note the default checkbox options:

CleanShot 2025-06-10 at 11 22 49

  1. Switch the product type to 'Subscription' or 'Variable Subscription' and comfirm you now have an 'Allow to be gifted' checkbox in the mix. It should be unchecked by default:

CleanShot 2025-06-10 at 11 28 31

  1. Navigate to the 'Advanced' tab, and change 'Limit subscription' away from 'Do not limit'. Confirm that the 'Allow to be gifted' checkbox goes away. Switch it back to 'Do not limit'.
  2. Make sure our show/hide behaviour works nicely: try checking the checkbox, switching the product back to a simple product, switching back to a subscription product, and confirm that it "remembers" its state while making the initial edits.
  3. Fully set up and publish two subscription products, one with 'Allow to be gifted' checked, and one with 'Allow to be gifted' unchecked (so if you've checked it and change it to a simple product then back, it remains checked).
  4. Run through a checkout on the front end with each product; confirm you get the 'This purchase is a gift' checkbox only on the product where it's allowed:

CleanShot 2025-06-10 at 11 51 49

  1. View the individual product pages for each of the products; confirm that the 'This purchase is a gift' checkbox only appears when 'Allow to be gifted' is enabled on the product:

CleanShot 2025-06-10 at 11 57 34

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 ran tests with your changes locally?

@laurelfulford laurelfulford added the [Status] Needs Review The issue or pull request needs to be reviewed label Jun 12, 2025
@laurelfulford laurelfulford marked this pull request as ready for review June 12, 2025 00:18
@laurelfulford laurelfulford requested a review from a team as a code owner June 12, 2025 00:18
@laurelfulford
Copy link
Contributor Author

Switching this one back to 'Draft' mode while I dig into why it's not working for variable subscriptions.

@laurelfulford laurelfulford marked this pull request as draft June 13, 2025 18:55
@laurelfulford laurelfulford removed the [Status] Needs Review The issue or pull request needs to be reviewed label Jun 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants