Removing redundancies in Woo-Commerce node. (#596)

* Iterating additionalFields given instead of hard coding the interface to match them when creating a product

* Removed redundancy for product creation/update and order create.

Co-authored-by: Omar Ajoue <krynble@gmail.com>
This commit is contained in:
Jacob Burrell
2021-08-04 09:06:15 -07:00
committed by GitHub
parent ce354ed0cf
commit caa6a3d234
4 changed files with 22 additions and 258 deletions

View File

@@ -149,6 +149,12 @@ export function toSnakeCase(data:
}
}
export function setFields(fieldsToSet: IDataObject, body: any) {
for(let fields in fieldsToSet) {
body[snakeCase(fields.toString())] = fieldsToSet[fields]
}
}
export function adjustMetadata(fields: IDataObject & Metadata) {
if (!fields.meta_data) return fields;