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

Inconsistent value for ProductAttribute name and option in LocalProductAttribute and GlobalProductAttribute #280

Closed
hwsiew opened this issue May 12, 2020 · 4 comments · Fixed by #314

Comments

@hwsiew
Copy link
Contributor

hwsiew commented May 12, 2020

Describe the bug
When query the attributes of a variable product, the name field of LocalProductAttribute return the name of attribute, but the name of GlobalProductAttribute return the slug of attribute. The same result goes to the options field for both.

To Reproduce
Steps to reproduce the behavior:

  1. Add both global and local attributes (use Capital letter for attribute's name to see the different between slug and name) in a variable product.
  2. Query the product attributes' name.
  3. Notice that for global attribute, the name field prefix 'pa_' which is the slug of the attribute.
  4. Check the local attribute, the name field is the attribute's name. Why? because slug will be sanitize and no space or capital letter should be in the field.
  5. Same goes to the options field

Expected behavior
the name and option fields should be either slug or name of attribute for both local and global attribute.

Screenshots
image

@travis-r6s
Copy link

Similarly, the values for these also differ in casing - the list of options under the global attribute are all lowercase, while the global attribute value for a variant is in uppercase:
image

@kireSuomi
Copy link

This still dosent work as its supposed to
The "label" field does not reflect its actual value.

@kidunot89

bild

bild

@kidunot89
Copy link
Member

kidunot89 commented Mar 20, 2023

@kireSuomi local product attribute values don't have labels, unlike global product attribute values which are taxonomy terms in the underlying data structure, just the string value itself 🤔.

Label data doesn't exist for local attribute in core WooCommerce, so the value is just passed back. Do you feel this behavior is incorrect.

@kireSuomi
Copy link

kireSuomi commented Mar 21, 2023

But the name is stored on the product in the database, im just supprised WCGraphql dosent cover it..
The label is "Höjd över marknivå" but the label field returns something that looks like a slug. Is there any way to get the "Höjd över marknivå" via graphql?

@kidunot89

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 a pull request may close this issue.

4 participants