OPEN-DSI / ecommerceng_woosync

WooSync, synchronize Woocommerce and Dolibarr
GNU General Public License v3.0
71 stars 46 forks source link

Incorrect usage of Woocommerce API for product metadata/attributes #93

Open madmaxpt opened 1 year ago

madmaxpt commented 1 year ago

The condition to include product attributes uses the metadata flag from the database (https://github.com/OPEN-DSI/ecommerceng_woosync/blob/2022.5.3/class/data/woocommerce/eCommerceRemoteAccessWoocommerce.class.php#L2778)

When using product metadata, the resulting PUT query to Woocommerce contains a "attributes" array whose values IDs are string litterals, whereas Woocommerce expects an integer ID.

Product synchronisation fails with error message

"{'code':'rest_invalid_param','message':'Paramètre(s) non valide(s) : attributes','data':{'status':400,'params':{'attributes':'Le paramètre attributes[0][id] n’est pas de type integer.'},'details':{'attributes':{'code':'rest_invalid_type','message':'Le paramètre attributes[0][id] n’est pas de type integer.','data':{'param':'attributes[0][id]'}}}}}"