Skip to content

Fix title breadcrumbs in WC 5.8 #224

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

Merged
merged 3 commits into from
Oct 21, 2021
Merged

Conversation

tomalec
Copy link
Contributor

@tomalec tomalec commented Oct 13, 2021

Changes proposed in this pull request

Screenshots

Detailed test instructions

  1. Checkout the branch
  2. npm install
  3. npm run build
  4. Open any Pinterest page, like /wp-admin/admin.php?page=wc-admin&path=%2Fpinterest%2Fonboarding
  5. Check the page title, document.title in console

You should see

'Onboarding Guide ‹ Pinterest ‹ Marketing ‹ WooCommerce ‹ gla1.test title — WooCommerce'

instead of

'Onboarding Guide ‹ Pinterest ‹ Marketing ‹ ‹ gla1.test title — WooCommerce'
'Onboarding Guide ‹ Pinterest ‹ Marketing ‹ false ‹ gla1.test title — WooCommerce'

Changelog note

Fix|New|Dev: Add suggested changelog note here

Todo

  • figure out why sometimes it returns false
  • Check if webpack config change is needed, if we update the WooDEWP

Additional notes

This PR introduces a dependency that is not mentioned in package.json which may break local unit tests in the future, but at least it somewhat indicates where the wcSettings global comes from. Still, behind DEWP mystery, but at least "somewhat".

instead of global `window.wcSettings` or settings store `getSetting`.
Improves WC5.8 compatibility.

Note, that the package is not published and not added to dependencies.

Works around woocommerce/woocommerce-admin#7781
@findingsimple
Copy link
Contributor

Thanks @tomalec !

to reduce the technical debt.
@tomalec tomalec added the status: blocked The issue is blocked from progressing, waiting for another piece of work to be done. label Oct 15, 2021
@tomalec
Copy link
Contributor Author

tomalec commented Oct 15, 2021

The WC 5.6-5.8 compatible way to obtain woocommerceTranslation way is

const woocommerceTranslation = wc.wcSettings.getSetting('woocommerceTranslation') || wc.wcSettings.getSetting('admin')?.woocommerceTranslation;

It seems that wc-settings given by DEWP come from a different package than we anticipated in the beginning.

It's not wc-admin-settings, but @woocommerce/settings which may or may not be https://www.npmjs.com/package/@woocommerce/settings it would require deeper digging as the links there are broken.

@tomalec tomalec removed the status: blocked The issue is blocked from progressing, waiting for another piece of work to be done. label Oct 18, 2021
@tomalec tomalec marked this pull request as ready for review October 18, 2021 13:57
@findingsimple
Copy link
Contributor

@eason9487 would you mind giving this one a review too please?

Copy link
Member

@eason9487 eason9487 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.

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

Successfully merging this pull request may close these issues.

3 participants