-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Conversation
<p> | ||
{ translate( "Your store's taxes are being managed by a third-party plugin. " ) } | ||
<ExternalLink icon href={ adminUrl } rel="noopener noreferrer"> | ||
{ translate( 'Plugin settings' ) } |
There was a problem hiding this comment.
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.' ), { |
There was a problem hiding this comment.
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).
f56194e
to
eb317c7
Compare
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; And if it's not (services is handling taxes) you see this; 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. |
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)
with
|
There was a problem hiding this 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:
-
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing isRequestingSitePlugins
, and siteSlug
There was a problem hiding this comment.
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 => { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 ) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
I think that text makes sense. It's definitely less confusing. |
@justinshreve wrote:
Fixed in 9d70316 looks like this now @jameskoster |
@timmyc wrote:
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.) |
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. |
@allendav still seeing the issue on my site with this branch - another gif from this morning: TaxJar installed but disabled: |
@jameskoster wrote:
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 |
8659592
to
e7c566c
Compare
@timmyc wrote:
@timmyc - a few questions (or grant me access to that site)
|
@jameskoster wrote:
Good point. OK, let's do this then. If the TaxJar plugin is active on their site, we'll show this 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' ) } |
There was a problem hiding this comment.
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 I just sent you an invite to my test site. Feel free to do whatever you please there... make yourself at home 🏚 |
@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.
|
@jameskoster - with 806731b we now have |
<p> | ||
{ translate( "You can manage this plugin's settings in wp-admin. " ) } | ||
<ExternalLink icon href={ adminUrl } rel="noopener noreferrer"> | ||
{ translate( 'Plugin settings' ) } |
There was a problem hiding this comment.
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 one final nitpick; let's lose the bottom margin on the final paragraph :) |
@jameskoster wrote:
Fixed in 8d4fab1 |
There was a problem hiding this 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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 ) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ); |
There was a problem hiding this comment.
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 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 4dc1307
@timmyc - still good to go with the last round of changes? |
Yep @allendav - still looking good 👍 |
Please ignore my previous mention as it was incorrectly referenced. |
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.