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

CSV import does not import non translatable custom fields correctly #2785

Open
jnugh opened this issue Apr 16, 2024 · 2 comments
Open

CSV import does not import non translatable custom fields correctly #2785

jnugh opened this issue Apr 16, 2024 · 2 comments
Assignees
Labels
type: bug 🐛 Something isn't working

Comments

@jnugh
Copy link
Contributor

jnugh commented Apr 16, 2024

Describe the bug
When doing a CSV import e.g. during an e2e test custom fields are not being imported correctly if they are not translatable. The customFields are being exported to the translated entity instead.

Check: https://github.com/vendure-ecommerce/vendure/blob/master/packages/core/src/data-import/providers/import-parser/import-parser.ts#L401C20-L401C50

parsedCustomFields is being created and stored in the translation. customFields are never being assigned to parsedProduct .

        const parsedProduct: ParsedProduct = {
            assetPaths: parseStringArray(r.assets),
            optionGroups,
            facets,
            translations,
        };

To Reproduce
Steps to reproduce the behavior:

  1. Create a CSV file with variant:customFieldName where customFieldName is a non-translatable custom field
  2. Import the CSV
  3. The custom field has a default value in the database

Expected behavior
The field should be populated from the CSV file

Environment (please complete the following information):

  • @vendure/core version: 2.1 (but the code looks the same on master)
  • Nodejs version: 20
  • Database (mysql/postgres etc): psotgres

Additional context
I'd gladly create a PR for this issue.

@jnugh jnugh added the type: bug 🐛 Something isn't working label Apr 16, 2024
@hans-rollingridges-dev
Copy link
Contributor

hans-rollingridges-dev commented Apr 16, 2024

This version 2.1.8 issue could be related as well: https://discord.com/channels/1100672177260478564/1222882518139801631/1222882518139801631
Unfortunately, I won't have time to look at issues with translations until begin of May.

@jnugh
Copy link
Contributor Author

jnugh commented Apr 17, 2024

The linked message is not related to the CSV import. There is also a pretty obvious fix I could create a PR for. Just wanted to create an issue before creating a Pull Request because this is how it's described in CONTRIBUTING.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants