This repository was archived by the owner on May 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 329
This repository was archived by the owner on May 28, 2023. It is now read-only.
o2m: region does not sync #316
Copy link
Copy link
Closed
Description
Hello
while doing some tests with v1.9 I noticed that o2m.js only uses the field region as an alternative for performing the m2-directory lookup (in case regionCode is missing), but does not forward the field alongside the other ones.
This leads to the scenario where, if no matching directory data is present in m2 db, the "free-text" region information is simply lost (will always end up with regionId: 0, regionCode: '' - here)
From my tests (with m2.3.2), if passing all of regionId, regionCode, and region, if the Id and Code are populated they will still take precedence, with region only acting as a fallback; because of this I think a simple patch like the following could do:
diff --git a/src/platform/magento2/o2m.js b/src/platform/magento2/o2m.js
index 81cfc06..d09157a 100644
--- a/src/platform/magento2/o2m.js
+++ b/src/platform/magento2/o2m.js
@@ -176,6 +176,7 @@ function processSingleOrder(orderData, config, job, done, logger = console) {
"email": billingAddr.email,
"regionId": mappedBillingRegion.regionId,
"regionCode": mappedBillingRegion.regionCode,
+ "region": billingAddr.region,
"company": billingAddr.company,
"vatId": billingAddr.vat_id
},
@@ -197,6 +198,7 @@ function processSingleOrder(orderData, config, job, done, logger = console) {
"email": shippingAddr.email,
"regionId": mappedShippingRegion.regionId,
"regionCode": mappedShippingRegion.regionCode,
+ "region": shippingAddr.region,
"company": shippingAddr.company
}
} else {
nuovecode
Metadata
Metadata
Assignees
Labels
No labels