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

Store: If TaxJar plugin is active, do not show core settings #19535

Merged
merged 9 commits into from
Nov 17, 2017

Conversation

allendav
Copy link
Contributor

@allendav allendav commented Nov 6, 2017

Fixes #17110

To test:

cc @jeffstieler @justinshreve @kellychoffman @jameskoster

edit: Note: I am going to submit a PR to TaxJar next to have them not hook :allofthethings: unless the user has both checked the enabled setting for their plugin AND entered an API key. That should help WCS easily work around active TaxJar plugins that are not fully configured with an API key.

screen shot 2017-11-06 at 12 46 17 pm

screen shot 2017-11-06 at 12 47 02 pm

@allendav allendav self-assigned this Nov 6, 2017
@matticbot
Copy link
Contributor

@allendav allendav requested review from timmyc and ryelle November 6, 2017 20:59
@allendav allendav added Store [Status] Needs Design Review Add this when you'd like to get a review / feedback from the Design team on your PR [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Nov 6, 2017
<p>
{ translate( "Your store's taxes are being managed by a third-party plugin. " ) }
<ExternalLink icon href={ adminUrl } rel="noopener noreferrer">
{ translate( 'Plugin settings' ) }
Copy link

Choose a reason for hiding this comment

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

Hi! I've found a possible matching string that has already been translated 21 times:
translate( 'Edit plugin settings' ) ES Score: 11

Help me improve these suggestions: react with 👎 if the suggestion doesn't make any sense, or with 👍 if it's a particularly good one (even if not implemented).

if ( onSuccessExtra ) {
onSuccessExtra();
}
return successNotice( translate( 'Settings updated successfully.' ), {
Copy link

Choose a reason for hiding this comment

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

Hi! I've found a possible matching string that has already been translated 24 times:
translate( 'Theme settings updated successfully.' ) ES Score: 13
See 2 additional suggestions in the PR translation status page

Help me improve these suggestions: react with 👎 if the suggestion doesn't make any sense, or with 👍 if it's a particularly good one (even if not implemented).

@allendav allendav force-pushed the fix/17110-store-tax-settings-detect-taxjar branch from f56194e to eb317c7 Compare November 7, 2017 18:46
@jameskoster
Copy link
Contributor

jameskoster commented Nov 9, 2017

OK, I need a rundown on this cause it feels a little weird how I understand it currently.

The issue is the TaxJar plugin doesn't work properly in Calypso and has been superseded by functionality in Services, right?

So, if the TaxJar plugin is active, you see this;

screen shot 2017-11-06 at 12 46 17 pm

And if it's not (services is handling taxes) you see this;

screen shot 2017-11-06 at 12 47 02 pm

Is that right? If so, the flow of heading over to manage plugins, deactivating TaxJar, then coming back to the tax settings screen to learn that my taxes are now being handled by........ TaxJar... would feel very odd xD

Just want to make sure my understanding is correct before giving feedback.

@allendav
Copy link
Contributor Author

allendav commented Nov 13, 2017

@jameskoster

It is a little odd - it is because we used to install the TaxJar plugin for people and then hooked it to allow WooCommerce Services to drive requests through WooCommerce Services' server to the TaxJar server.

Now, WooCommerce Services can do tax calculations without the TaxJar plugin installed (and yet it still uses TaxJar on the backend so we need to give the data privacy notice.)

We still want to allow people to continue to use the TaxJar plugin if they want to (e.g. for filing their taxes electronically) so that's basically why we have these two views (one view with TaxJar plugin active and one view without)

So... all that said, I would like us to consider replacing (for the "without" case)

Sales tax calculations are provided by a third party: TaxJar. By enabling this option, TaxJar will have access to some of your data. Learn more.

with

Sales tax calculations are provided by WooCommerce Services. When this option is enabled, WooCommerce Services will share some of your data with a third party. Learn more.

cc @jeffstieler @pmaiorana @justinshreve

Copy link
Contributor

@timmyc timmyc left a comment

Choose a reason for hiding this comment

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

Some minor comments above. Verified things rendered as expected when taxjar was installed/enabled vs not. I did encounter some odd behavior editing - which I've tried to capture in a .gif with 🐭 waving:

address-change

  • The Tax Rates block is rendered later than the rest of the page, which I'm guessing has to do with the plugin list loading - but it results in the page jumping around a bit. Not sure if we want a placeholder here to make it feel less choppy. Note - this is happening in production too, so maybe moot.

  • I uncheck the "charge taxes on shipping costs", save, am told things are all good, but upon refresh the old setting is still shown. Note, this is also happening in production 😆

className: PropTypes.string,
siteId: PropTypes.number,
sitePluginsLoaded: PropTypes.bool,
taxJarPluginActive: PropTypes.bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

missing isRequestingSitePlugins, and siteSlug

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 8659592

} ),
};

onDeactivate = event => {
Copy link
Contributor

Choose a reason for hiding this comment

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

It appears this isn't used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops - fixed in 8659592


render = () => {
const { className, site, translate } = this.props;

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to be concerned about site being null here at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should not be null, but defensively changed site to isRequired in 8659592

slug: PropTypes.string,
ID: PropTypes.number,
} ),
className: PropTypes.string,
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing a few props loaded, pricesIncludeTaxes, shippingIsTaxable, taxesEnabled

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 8659592

componentDidMount = () => {
const { site } = this.props;

if ( site && site.ID ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

we could pass in siteId as a prop and simplify some of the logic here and in componentWillReceiveProps

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed! Fixed in 054bd7f


render = () => {
const { className, loaded, site, translate } = this.props;

Copy link
Contributor

Choose a reason for hiding this comment

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

Again any concern or possibility of site being null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No possibility, but I just made it isRequired in 054bd7f

@justinshreve
Copy link
Contributor

Sales tax calculations are provided by WooCommerce Services. When this option is enabled, WooCommerce Services will share some of your data with a third party. Learn more.

I think that text makes sense. It's definitely less confusing.

@allendav
Copy link
Contributor Author

@justinshreve wrote:

Sales tax calculations are provided by WooCommerce Services. When this option is enabled, WooCommerce Services will share some of your data with a third party. Learn more.

I think that text makes sense. It's definitely less confusing.

Fixed in 9d70316 looks like this now @jameskoster

screen shot 2017-11-13 at 11 49 44 am

@allendav
Copy link
Contributor Author

@timmyc wrote:

I uncheck the "charge taxes on shipping costs", save, am told things are all good, but upon refresh the old setting is still shown. Note, this is also happening in production

I can't reproduce this with this branch - are you sure the TaxJar plugin is not still active on your site? (It forces these settings' values and can cause this behavior, which is basically why we are doing this PR.)

@jameskoster
Copy link
Contributor

Sales tax calculations are provided by WooCommerce Services. When this option is enabled, WooCommerce Services will share some of your data with a third party. Learn more.

I thought we were averse to highlighting 'WooCommerce' anywhere in Store?

I actually think it's the other card which is the problem. "Your store's taxes are being handled by a third-party plugin" just feels too vague. It reminds me of one of those unhelpful Windows error messages from years gone by xD

Couldn't we be more explicit there? Explain that they're running the TaxJar plugin which is no longer required unless they want to do x & y. Then re-assure them that if they deactivate it their store will continue to function just fine.

@timmyc
Copy link
Contributor

timmyc commented Nov 14, 2017

@allendav still seeing the issue on my site with this branch - another gif from this morning:

tax-settings-branch

TaxJar installed but disabled:

plugins_ timmy_s_flies _wordpress

@allendav
Copy link
Contributor Author

allendav commented Nov 14, 2017

@jameskoster wrote:

I thought we were averse to highlighting 'WooCommerce' anywhere in Store?

I think we need too not be afraid to mention WooCommerce Services - after all, WooCommerce Services is a product we want to sell through Store on WPCOM. cc @toddwilkens @jeffstieler

@allendav allendav force-pushed the fix/17110-store-tax-settings-detect-taxjar branch from 8659592 to e7c566c Compare November 14, 2017 17:15
@allendav
Copy link
Contributor Author

allendav commented Nov 14, 2017

@timmyc wrote:

still seeing the issue on my site with this branch - another gif from this morning

@timmyc - a few questions (or grant me access to that site)

  1. Are you able to toggle the setting (and get it to stick after save) if tax calculations are enabled?
  2. In wp-admin on that site ( /wp-admin/admin.php?page=wc-settings&tab=tax ), when tax calculations are enabled, are you able to change the Shipping Tax Class setting from Zero Rate to Standard and have it stick? What appears in calypso after a refresh?
  3. In wp-admin on that site, when tax calculations are enabled, are you able to change the Shipping Tax Class setting from Standard to Zero Rate and have it stick? What appears in calypso after a refresh?
  4. In wp-admin on that site, I presume you still have standard rate and zero rate sub-tabs?

standard-and-zero-rate-sub-tabs

@allendav
Copy link
Contributor Author

@jameskoster wrote:

Couldn't we be more explicit there? Explain that they're running the TaxJar plugin which is no longer required unless they want to do x & y. Then re-assure them that if they deactivate it their store will continue to function just fine.

Good point. OK, let's do this then. If the TaxJar plugin is active on their site, we'll show this

screen shot 2017-11-14 at 10 02 17 am

Sound good?

'You can manage settings, including your personal TaxJar API key, in the plugin settings. '
) }
<ExternalLink icon href={ adminUrl } rel="noopener noreferrer">
{ translate( 'Plugin settings' ) }
Copy link

Choose a reason for hiding this comment

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

Hi! I've found a possible matching string that has already been translated 21 times:
translate( 'Edit plugin settings' ) ES Score: 11

Help me improve these suggestions: react with 👎 if the suggestion doesn't make any sense, or with 👍 if it's a particularly good one (even if not implemented).

@timmyc
Copy link
Contributor

timmyc commented Nov 14, 2017

@allendav I just sent you an invite to my test site. Feel free to do whatever you please there... make yourself at home 🏚

@jameskoster
Copy link
Contributor

jameskoster commented Nov 15, 2017

@allendav I think this is an improvement. It's a bit wordy but it's all relevant.

Perhaps to break things up a little we should bullet-list the features the plugin adds. Then switch the last 2 paragraphs.

Your store’s taxes are being managed by the TaxJar - Sales Tax Automation for WooCommerce plugin. This plugin provides optional features such as:

  • Automated reporting & filing
  • Multi-nexus support

If you don’t need these features we recommend removing this plugin. Don’t worry, we’ll still handle sales tax calculations for you.

You can manage this plugin’s settings in wp-admin.

@allendav
Copy link
Contributor Author

@jameskoster - with 806731b we now have

screen shot 2017-11-15 at 11 24 09 am

<p>
{ translate( "You can manage this plugin's settings in wp-admin. " ) }
<ExternalLink icon href={ adminUrl } rel="noopener noreferrer">
{ translate( 'Plugin settings' ) }
Copy link

Choose a reason for hiding this comment

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

Hi! I've found a possible matching string that has already been translated 21 times:
translate( 'Edit plugin settings' ) ES Score: 11

Help me improve these suggestions: react with 👎 if the suggestion doesn't make any sense, or with 👍 if it's a particularly good one (even if not implemented).

@allendav
Copy link
Contributor Author

@timmyc - I tracked down your lack-of-stickyness issue and wrote it up separately here - #19857 - not sure how your site got in that state

@jameskoster
Copy link
Contributor

@allendav one final nitpick; let's lose the bottom margin on the final paragraph :)

@allendav
Copy link
Contributor Author

@jameskoster wrote:

@allendav one final nitpick; let's lose the bottom margin on the final paragraph :)

Fixed in 8d4fab1

screen shot 2017-11-16 at 9 06 17 am

Copy link
Contributor

@timmyc timmyc left a comment

Choose a reason for hiding this comment

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

Couple other minor comments, otherwise this is looking good to me code-wise

};

componentDidMount = () => {
const { site } = this.props;
const { isRequestingSitePlugins, siteId, sitePluginsLoaded } = this.props;
Copy link
Contributor

Choose a reason for hiding this comment

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

This logic is duplicated in componentWillReceiveProps. Perhaps it can be extracted into a maybeFetchPlugins method and called in both lifecycle methods?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 4dc1307


if ( site && site.ID ) {
this.props.fetchTaxSettings( site.ID );
if ( siteId && ! isRequestingSitePlugins && ! sitePluginsLoaded ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The only thing that I thought could go awry here is that potentially site plugins could become stale in the context of this component. Since sitePluginsLoaded just checks to see if the plugins array is empty, we could potentially not fetch the latest plugin data here... i.e. I change plugin status outside of calypso.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you are on the Settings > Taxes page, then go to Plugins and install and activate TaxJar, then return to the Settings > Taxes page, you'll have this problem too. I'll come up with a fix.

Copy link
Contributor

Choose a reason for hiding this comment

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

It isn't super critical imho, but figured it is worth noting. Could be handled in a subsequent PR.

Copy link
Contributor Author

@allendav allendav Nov 16, 2017

Choose a reason for hiding this comment

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

OK, in 2e6ebd3 I made a change so that if you install/activate TaxJar from Calypso and return to the Taxes Settings view (in the same tab/window), at least we'll update appropriately. It doesn't solve the problem of navigating to wp-admin in a separate tab/window and messing there, but it is a start.

I've written #19928 for the case where they use another window/tab to deactivate/activate the TaxJar plugin.

}
};

componentWillReceiveProps = nextProps => {
if ( nextProps.loadedSettingsGeneral ) {
if ( ! nextProps.loadedTaxRates ) {
this.props.fetchTaxRates( nextProps.site.ID, nextProps.address );
this.props.fetchTaxRates( nextProps.siteId, nextProps.address );
Copy link
Contributor

Choose a reason for hiding this comment

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

could these two if conditions be combined here? if ( nextProps.loadedSettingsGeneral && ! nextProps.loadedTaxRates )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 4dc1307

@allendav
Copy link
Contributor Author

@timmyc - still good to go with the last round of changes?

@timmyc
Copy link
Contributor

timmyc commented Nov 16, 2017

Yep @allendav - still looking good 👍

@allendav allendav merged commit f149e84 into master Nov 17, 2017
@allendav allendav deleted the fix/17110-store-tax-settings-detect-taxjar branch November 17, 2017 03:10
@matticbot matticbot removed [Status] Needs Design Review Add this when you'd like to get a review / feedback from the Design team on your PR [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Nov 17, 2017
@yansern
Copy link
Contributor

yansern commented Jan 23, 2020

Please ignore my previous mention as it was incorrectly referenced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WooCommerce - controls on the tax settings page always revert
7 participants