Functions review/development for integration through REST API (WordPress, WooCommerce, and WPML)

Job ID: 34775384

Budget: $30 – $250 CAD

https://docs.google.com/document/d/1eIVmr9wL1bxt7ReXpCRIdc5bslUeVcrxXDf4g6HNAFk/edit?usp=sharing

We have developed relevant functions for tapping into relevant hooks as described in the document. We decided to merge the Product and Product Variant calls and only use Product REST API calls for the base language.

Within the rest API hook of the product POST/PUT rest API calls, we extract the product translation content and the variants. The function is responsible for
- creating/updating the variants of the product in the main language
- creating/updating the main product translation
- links the translated product to the main language product
- re-synchronizes variant product data (creates missing variant translations, updates variant translations: stock, price, weight, dimensions, SKU, descriptions)

In order to accomplish the above and make it work successfully, it seems that the cache needs to be cleared correctly (concerning the product and product variants that are being updated/created). WPML and Woocommerce (along with the object cache from pressable hosting) seem to store things in the cache that we could not find that keep messing with the correct update of translated variants. Because of this, we ended up using the wp_flush_cache() function at the start of our hook function. As you can understand, this can lead to performance issues of the eshop.

We would like a WPML/Woocommerce expert to review our functions for refactoring and improving the code of our function where necessary. Most importantly, we would like to avoid having to use wp_flush_cache() for every product update, so we need a solution to this problem as well.

Functions code can be provided. We are testing using Postman/Insomnia calls.