Closed bossanova808 closed 1 year ago
Yeah it's a bug, you should be able to select the field. Will get it fixed.
This is what it is doing currently:
$commerceFields = [];
if (self::$commercePlugin !== null) {
$productTypes = self::$commercePlugin->getProductTypes()->getAllProductTypes();
foreach ($productTypes as $productType) {
$productFields = $this->getPullFieldsFromLayoutId($productType->fieldLayoutId);
/** @noinspection SlowArrayOperationsInLoopInspection */
$commerceFields = array_merge($commerceFields, $productFields);
if ($productType->hasVariants) {
$variantFields = $this->getPullFieldsFromLayoutId($productType->variantFieldLayoutId);
/** @noinspection SlowArrayOperationsInLoopInspection */
$commerceFields = array_merge($commerceFields, $variantFields);
}
}
}
That seems like it should work...?
Added in 4.0.0-beta.2
(Latest of both Craft and this plugin obviously)
My brand field is not available in this list:
It is an Entries field:
How is this selection built? Is it e.g. filtering out fields that are not on ALL product types perhaps?
In the past I have used code to add the brand, by the looks of thing, but be easier if I could just select the field (and ideally a fallback value if the field is empty or N/A)