You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered an issue when importing a new Product and Variant in Craft Commerce. The error occurs during the parseField function when it tries to import values into custom fields.
The error message is as follows:
Error: Call to a member function getFieldByHandle() on null in /var/www/html/vendor/craftcms/feed-me/src/services/Fields.php:216
I have added some logs to investigate the issue and found that the error appears when attempting to import a custom field either at the Product or Variant level.
Logs for importing a custom field at the Product level:
Logs for importing a custom field at the Variant level:
2024-10-03 17:44:39 [queue.ERROR] [application] log element: {"elementQueryResult":null,"eagerLoadInfo":null,"id":null,"tempId":null,"draftId":null,"revisionId":null,"isProvisionalDraft":false,"uid":null,"siteSettingsId":null,"fieldLayoutId":null,"structureId":null,"enabled":true,"archived":false,"siteId":2,"title":null,"slug":null,"uri":null,"dateCreated":null,"dateUpdated":null,"dateLastMerged":null,"dateDeleted":null,"deletedWithOwner":null,"root":null,"lft":null,"rgt":null,"level":null,"searchScore":null,"trashed":false,"awaitingFieldValues":false,"propagating":false,"propagatingFrom":null,"propagateAll":false,"newSiteIds":[],"isNewForSite":false,"resaving":false,"duplicateOf":null,"firstSave":false,"mergingCanonicalChanges":false,"updatingFromDerivative":false,"previewing":false,"forceSave":false,"hardDelete":false,"width":null,"height":null,"length":null,"weight":0,"freeShipping":false,"promotable":true,"availableForPurchase":true,"minQty":null,"maxQty":null,"inventoryItemId":null,"inventoryTracked":true,"isDefault":false,"sortOrder":null,"deletedWithProduct":false,"fieldId":null,"saveOwnership":true,"updateSearchIndexForOwner":false} {"memory":9407552}
2024-10-03 17:44:39 [queue.ERROR] [application] log getFieldLayout: null {"memory":9407832}
2024-10-03 17:44:39 [queue.ERROR] [feed-me] {"message":"`Call to a member function getFieldByHandle() on null - Fields.php: 219`.","feed":"PRODUCTS - IMPORT - Non-alcoholic","key":"fwftoaqldwansaohxxqe"} {"memory":9413288}
2024-10-03 17:44:39 [queue.ERROR] [Error] Error: Call to a member function getFieldByHandle() on null in /var/www/html/vendor/craftcms/feed-me/src/services/Fields.php:219
From the logs, it’s clear that $element->getFieldLayout() is returning null, and the $element object has no fieldLayoutId, id, or draftId.
Steps to Reproduce
Try to import a new Product and Variant with custom fields that do not yet exist in Craft Commerce using FeedMe.
Monitor the logs and observe the error when the import process reaches the parseField function for custom fields.
Expected Behavior
The product and variant should be imported successfully, including their custom fields.
Actual Behavior
The import process fails when trying to assign values to custom fields, resulting in the error:
Call to a member function getFieldByHandle() on null - Fields.php:216.
I'm experiencing two major issues with Feed Me 6.4.0 when using Craft Commerce 5:
Custom Fields on Variants: There is an issue importing data into custom fields for product variants, which wasn't present in version 6.3.0.
Content Propagation Across Sites: The content isn't being properly propagated across all my sites. This worked fine in version 6.3.0.
Is it possible to release a dev version with only the stock import fix from 6.4.0? This would allow me to bypass the regressions in 6.4.0 while still benefiting from the stock import improvements.
Description
I encountered an issue when importing a new Product and Variant in Craft Commerce. The error occurs during the parseField function when it tries to import values into custom fields.
The error message is as follows:
Logs for importing a custom field at the Product level:
Logs for importing a custom field at the Variant level:
From the logs, it’s clear that $element->getFieldLayout() is returning null, and the $element object has no fieldLayoutId, id, or draftId.
Steps to Reproduce
Try to import a new Product and Variant with custom fields that do not yet exist in Craft Commerce using FeedMe.
Monitor the logs and observe the error when the import process reaches the parseField function for custom fields.
Expected Behavior
The product and variant should be imported successfully, including their custom fields.
Actual Behavior
The import process fails when trying to assign values to custom fields, resulting in the error:
Call to a member function getFieldByHandle() on null - Fields.php:216.
Versions
Craft CMS: 5.4.6
Craft Commerce: 5.1.3
FeedMe: 6.4.0
The text was updated successfully, but these errors were encountered: