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

Support for Metadata fields and Misc Data #24

Merged
merged 4 commits into from
Jan 5, 2020

Conversation

kvindascr
Copy link

Hello @pasdo501

I have been working on a ecom site with Gatbsy and WooCommerce.
I have been using this plugin to feed my site with the WooCommerce info, but I found an issue, where the products metadata is not arriving properly.

In particular Yoast SEO config.

Basically what occurs is that metadata is arriving but not the metadata.value.
I'm not a GraphQL expert, but I assumed the error occur because the metadata value type varies.
In some cases it is a string, in others a number and in others an array.

In order to solve that, I have standardize the metadata field to always be a string array.

Also, I found another issue in specific when querying misc data such as data/countries where the data is not successfully returned, because they have no ids.
I'm no Wordpress expert either, but seems that this information is not stored in database, rather in files.
And due to the this, all the nodes comes without an id.

I have modified the process so that in the cases where the nodes have no ids, it can compute an id based on a code property and the field name. Example datacountries/USA.

I have also created some unit testing for the new code.

I have decided to add a new file called misc_data.js to not add additional logic to the current helper file.

Final comment, I'm seeing several formatting changes on the gatsby-node file, although I just added the usage of getWCNodeId and mapNodeNormalizeMetadata, I'm wondering now if my IDE did those automatically.

Add support for data/countries/continents/currencies.
Add support for data/countries/continents/currencies.
0.12.0 support for metadata
@pasdo501 pasdo501 merged commit 1ca752b into pasdo501:master Jan 5, 2020
@pasdo501
Copy link
Owner

pasdo501 commented Jan 5, 2020

Hi @kvindasAB,

Thanks for your contribution here!

PS. I think you're right about the metadata value being excluded if there are different types available, I've come across issues like that in the past.

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.

None yet

2 participants