-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Products pricing section code cleanup #34560
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
Conversation
Test Results SummaryCommit SHA: 51f7542
To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
louwie17
left a comment
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.
LGTM 🚀 nice work @mattsherman, thanks for keeping it small and not including it as part of other work ( I have something to learn from you :) )
Also appreciate not seeing the giant deprecated warning in the console anymore 👍 👍
| const taxSettingsText = | ||
| 'Per your {{link}}store settings{{/link}}, tax is {{strong}}%sincluded{{/strong}} in the price.'; | ||
| const addNot = pricesIncludeTax ? '' : 'not '; | ||
| taxSettingsText.replace( taxSettingsText, addNot ); | ||
|
|
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 will need the addNot to add it when the tax is not included in the price (37-gh-woocommerce/mothra-private).
The code should look like this:
const addNot = pricesIncludeTax ? '' : 'not ';
const taxSettingsElement = interpolateComponents( {
mixedString: sprintf(
__(
'Per your {{link}}store settings{{/link}}, tax is {{strong}}%sincluded{{/strong}} in the price.',
'woocommerce'
),
addNot
),
components: {
link: (
<Link
href={ `${ ADMIN_URL }admin.php?page=wc-settings&tab=tax` }
target="_blank"
type="external"
onClick={ () => {
recordEvent( 'product_pricing_list_price_help' );
} }
>
<></>
</Link>
),
strong: <strong />,
},
} );
I missed that in my original PR.
octaedro
left a comment
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.
Good job @mattsherman! The code looks good and other than the comment I left this is testing well on my end.
fcddacb to
51f7542
Compare
louwie17
left a comment
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.
Thanks for reverting the one change that @octaedro mentioned, this still tests well.
🚢
All Submissions:
Changes proposed in this Pull Request:
This PR addresses a few code issues in the products pricing section:
Removes a bit of unused codeCurrency().formatCurrency, which is deprecated, toCurrency().formatAmountpriceValidationtosanitizeAndSetPrice, which is more accurate (it was not validating the price, but rather sanitizing it and then setting it) and swaps the order of thenameandvalue, which is more natural (name, value vs value, name)This is a follow up to #34382
How to test the changes in this Pull Request:
Products>Add New (MVPand create a product.Other information:
pnpm changelog add --filter=<project>?FOR PR REVIEWER ONLY: