Open richard-grosjean opened 4 years ago
I agree, the code suggested looks along the right lines, you are welcome to submit a pull request..! as there isn't rest customisation currently I'd suggest a new file. To follow the existing plugin scheme it would be a new class file in src/Hyyan/WPI and a line to create it in registerCore() in Plugin.php... potentially also added as a setting in Features.php which allows the various features to be turned on and off. at least that's how the other bits are implemented in this plugin.
Using the REST API, the WooCommerce products endpoint returns all language versions.
Based on #23 and my measly testing, it seems like using a parameter like "lang" to filter the language versions that the products endpoint returns is not currently possible.
Adding support for a param like this seems trivial, but I haven't looked into where and how to best place it in this plugin or even if the maintainer feels like a feature like this is desirable in this plugin (❤️ this plugin hyyan, hope you find your maintainer).
There might be a better (less general) hook to use, but here is some example code to help illustrate the feature: