Skip to content

Conversation

@dkoo
Copy link
Contributor

@dkoo dkoo commented May 2, 2025

When the product being checked is a variation, check the newspack_autocomplete_orders meta value for the parent item, not the variation.

All Submissions:

Changes proposed in this Pull Request:

#3072 added a custom product option to allow autocompletion of orders with that product. #3111 restricted this option to usage with "virtual" products, while #3692 rescinded that requirement based on publisher feedback, but didn't remove the wrapper classes that hid the option from non-virtual products and variations, creating confusion and making it impossible to properly set the option value on non-virtual products.

This PR clarifies the usage of the option by adding a new product_types config key to custom options, so that the options will only be shown and filters applied for products that match the supported types.

How to test the changes in this Pull Request:

  1. Check out this branch and pubilsh four products:
  • A simple product, non-virtual
  • A variable product, non-virtual, with variations
  • A simple subscription, virtual
  • A variable subscription, virtual, with variations
  1. For each of the four products, ensure that the "Auto-complete orders" checkbox option appears at the top of the "Product data" box for simple products and simple subscription products, while for variable products it appears only inside each variation and not at the top-level parent product's product data box. Leave the option checked for all products and variations.
Screenshot 2025-05-02 at 1 54 34 PM Screenshot 2025-05-02 at 1 54 46 PM
  1. As a reader, purchase all products/variations. In the admin, confirm that all orders are created with the "Completed" status.
  2. Uncheck the "Auto-complete orders" option for all products and variations and save.
  3. As a reader, repurchase all products/variations, and this time confirm that all orders are creating with the "Processing" status.

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?

dkoo added 2 commits May 2, 2025 13:22
When the product being checked is a variation, check the
`newspack_autocomplete_orders` meta value for the parent item, not the
variation.
@dkoo dkoo self-assigned this May 2, 2025
@dkoo dkoo requested a review from a team as a code owner May 2, 2025 19:57
@dkoo dkoo added the [Status] Needs Review The issue or pull request needs to be reviewed label May 2, 2025
Copy link
Member

@adekbadek adekbadek left a comment

Choose a reason for hiding this comment

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

Works as descibed 👌

@github-actions github-actions bot added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Review The issue or pull request needs to be reviewed labels May 29, 2025
@dkoo dkoo merged commit f8bf431 into release May 29, 2025
9 checks passed
@dkoo dkoo deleted the hotfix/autocomplete-variation-orders branch May 29, 2025 22:57
matticbot pushed a commit that referenced this pull request May 29, 2025
## [6.6.4](v6.6.3...v6.6.4) (2025-05-29)

### Bug Fixes

* **autocomplete-orders:** apply option to variations, not parent product ([#3958](#3958)) ([f8bf431](f8bf431))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 6.6.4 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released [Status] Approved The pull request has been reviewed and is ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants