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

Translations cannot be used in the woocomerce product object. #91

Open
gabysanchez opened this issue May 21, 2024 · 3 comments
Open

Translations cannot be used in the woocomerce product object. #91

gabysanchez opened this issue May 21, 2024 · 3 comments

Comments

@gabysanchez
Copy link

I am experiencing a peculiar error when trying to retrieve the translations of woocomerces products, I get an internal server error. This problem only occurs with the products

Captura de pantalla 2024-05-21 a las 15 42 53 Captura de pantalla 2024-05-21 a las 15 43 24

When I use the translation as any other object it works perfectly and the only error I find is the one shown in the images.

@michael2rain
Copy link

michael2rain commented May 22, 2024

I have the same problem. Did you find how to solve it?

@pablo-serranoAndres
Copy link

Im stuck in the same point :( Anyone have an idea?

@ehnsio
Copy link

ehnsio commented Nov 5, 2024

The issue is here:
wp-graphql-polylang-master/src/PostObject.php

$type = ucfirst($post_type_object->graphql_single_name);
$type returns 'Product' but it needs to be more specific 'SimpleProduct' etc.

$type = ucfirst($post_type_object->graphql_single_name);

Im temporarily doing this because in my use case I only need the common shared product fields.

register_graphql_field(
            $post_type_object->graphql_single_name,
            'translations',
            [
                'type' => [
                    'list_of' => $type === 'Product' ? 'SimpleProduct' : $type,
                ],

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

No branches or pull requests

4 participants