Skip to content

[5.x]: Variants in product fixtures don't have their custom fields saved. #3927

@boboldehampsink

Description

@boboldehampsink

What happened?

Description

Variants in product fixtures don't have their custom fields saved. Other attributes are saved.

Steps to reproduce

Create a "product fixture" that defines variants with custom fields.

<?php

return [
    [
        'typeId' => $this->productTypeIds['product'],
        'title' => 'test',
        'variants' => [
            'new1' => [
                'title' => 'foo',
                'sku' => 'this works',
                'fields' => [
                    'customField' => 'this doesnt',
                ],
            ],
        ],
    ],
];

Expected behavior

Variant is created, sku is filled and customField is filled

Actual behavior

Variant is created, only sku is filled

Craft CMS version

5.6.11

Craft Commerce version

5.3.4

PHP version

8.3

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions