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

Update add product task to only show "subscriptions" product type for stores in the US #33068

Merged

Conversation

chihsuan
Copy link
Member

@chihsuan chihsuan commented May 17, 2022

All Submissions:

Changes proposed in this Pull Request:

Closes #33062.

Enable the Subscription product template only for merchants in the US both on the card and stack layout.

How to test the changes in this Pull Request:

  1. Make sure your site has woocommerce_allow_tracking option set to yes
  2. Go to Tools > WCA Test Helper > Experiments
  3. Enable treatment for woocommerce_products_task_layout_stacked
  4. Go to OBW
  5. Set Country to the US
  6. Select "Subscriptions" in the Product Types step.
  7. Navigate to WooCommerce > Home
  8. Go to "Add products" task
  9. Observe that the subscriptions product type is shown
  10. Go to woocommmerce > Settings
  11. Change Country / State to another country.
  12. Go back to "Add products" task
  13. Observe that the subscriptions product type is hidden.

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 run tests with your changes locally?
  • Have you created a changelog file for each project being changed, ie pnpm nx changelog <project>?

FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

@github-actions github-actions bot added focus: react admin plugin: woocommerce Issues related to the WooCommerce Core plugin. labels May 17, 2022
@chihsuan chihsuan force-pushed the update/33062-subscriptions-product-type-only-in-the-us branch from 8f3146b to 10b91de Compare May 17, 2022 04:28
@github-actions github-actions bot removed the plugin: woocommerce Issues related to the WooCommerce Core plugin. label May 17, 2022
@chihsuan chihsuan force-pushed the update/33062-subscriptions-product-type-only-in-the-us branch from 10b91de to d8d6967 Compare May 17, 2022 04:36
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label May 17, 2022
@chihsuan chihsuan marked this pull request as ready for review May 17, 2022 04:49
@chihsuan chihsuan force-pushed the update/33062-subscriptions-product-type-only-in-the-us branch from d8d6967 to 3f6d917 Compare May 17, 2022 04:49
@chihsuan chihsuan self-assigned this May 17, 2022
@chihsuan chihsuan requested a review from a team May 17, 2022 04:49
@botwoo
Copy link
Collaborator

botwoo commented May 17, 2022

📊 Test reports for this pull request have been published and are accessible through the following links:

Latest commit referenced in the reports: Hide subscription product type when store country is unknown c551477
This comment will automatically be updated with the latest referenced commit when you push new changes to this pull request.


Visit the WooCommerce Test Reports homepage to view all published reports. See the FAQs page if you're having problems accessing them.

@botwoo
Copy link
Collaborator

botwoo commented May 17, 2022

📊 Test reports for 3f6d917 Add changelog have been published and are accessible through the following links:

Visit the WooCommerce Test Reports homepage to view all published reports. See the FAQs page if you're having problems accessing them.

Copy link
Contributor

@ilyasfoo ilyasfoo left a comment

Choose a reason for hiding this comment

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

Tested well, looking great @chihsuan! Feedback on TOS link:

components: {
tosLink: (
<Link
href="https://woocommerce.com/posts/terms-of-service-update/"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the usual TOS link we use is https://wordpress.com/tos/

Copy link
Member Author

@chihsuan chihsuan May 18, 2022

Choose a reason for hiding this comment

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

Good catch! I'll fix it in another PR.

Payment changes are not related to this PR. They're showing here because something is wrong after rebased. They have already been merged into the trunk.

Copy link
Member Author

Choose a reason for hiding this comment

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

A fix PR is ready: #33082

const country =
typeof settings.woocommerce_default_country === 'string'
? settings.woocommerce_default_country
: 'US';
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should default to non-US experience since the opposite can be slightly risky. The reason being is subscription type products are only supported for US countries afaik, so if a non-US store owner sets it up, it may end up not working and confuses the owner.

The other way around isn't too critical, subscription template will go missing which is only sub-optimal, but not breaking.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point!!! Changed in c551477

( productType ) => ! exclude.includes( productType.key )
);
export const getProductTypes = ( {
exclude,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice update! Much more expressive imo.

@chihsuan chihsuan force-pushed the update/33062-subscriptions-product-type-only-in-the-us branch from 3f6d917 to c551477 Compare May 18, 2022 02:19
@chihsuan chihsuan requested a review from ilyasfoo May 18, 2022 02:20
Copy link
Contributor

@ilyasfoo ilyasfoo left a comment

Choose a reason for hiding this comment

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

Tested well, LGTM! 🚢

@chihsuan chihsuan merged commit 9a15f68 into trunk May 18, 2022
@chihsuan chihsuan deleted the update/33062-subscriptions-product-type-only-in-the-us branch May 18, 2022 03:12
@github-actions github-actions bot added this to the 6.6.0 milestone May 18, 2022
@github-actions
Copy link
Contributor

Hi @chihsuan, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:

  • Add the release: add testing instructions label

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: woocommerce Issues related to the WooCommerce Core plugin.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Task List: Add Products Task - Subscriptions only in the US
3 participants