Skip to content

Variant metafields not accessible via product.variants #184

@lousaint

Description

@lousaint

Description

Variant metafields are not included in the variant data accessible via product.variants or product.getVariants().

From what I can see, variant metafields are successfully synced from Shopify and stored in the shopify_data table, but Product::getVariants() only gets the ProductVariant record from the shopify_data table, which does not include the variant metafield data. These are stored in separate Metafield records, and would need to be retrieved and added to each variant.

Steps to reproduce

  1. For a product where the variants have metafields defined, access the product's variants via product.getVariants().
  2. The variant arrays contain no metafields element.

Additional info

  • Craft version: 5.8.17
  • PHP version: 8.2.20
  • Database driver & version: MySQL 8.0.36
  • Plugins & versions:
    CKEditor 4.10.1
    Cloudflare 3.1.0
    DigitalOcean Spaces Filesystem 3.2.0
    Feed Me 6.10.1
    Guest Entries 4.0.1
    oEmbed 3.1.5
    Postmark 3.1.0
    Retour 5.0.12
    SEO 5.0.0
    Shopify 6.0.5
    Shortcodes 4.0.1
    Smith 3.1.1
    Social Login 2.0.10
    Typesense 5.8.0
    Vite 5.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions