<p>Yes using the onPopulateLineItem event. Something like this should work:</p>

<pre><code>craft()-&gt;on('commerce_lineItems.onPopulateLineItem', function($event){

    $purchasable = $event-&gt;params['purchasable'];
    $lineItem = $event-&gt;params['lineItem'];

    $lineItem-&gt;options = array_merge(
      $lineItem-&gt;options,
      ['customFieldLabel'=&gt;$purchasable-&gt;customField]
    );

});
</code></pre>

CC BY-SA 3.0
2017-04-25T21:31:38.997Z
2017-04-25T21:31:38.997Z
Luke Holder
<p>For Craft 3 Nathaniel from Pixel &amp; Tonic helped us with the below:</p>
<p>In the following example, I am adding the titles of a category relationship field productColours to the snapshot but only for the products in the product type of clothing.</p>
<pre><code>// Modify product snapshot
Event::on(Variant::class, Variant::EVENT_AFTER_CAPTURE_PRODUCT_SNAPSHOT, function(CustomizeProductSnapshotDataEvent $event) {
    $variant = $event-&gt;sender;
    if (!$variant instanceof Variant) {
        return;
    }

    $product = $variant-&gt;getProduct();
    if (!$product || $product-&gt;type-&gt;handle != 'clothing') {
        return;
    }

    $colours = $product-&gt;productColours-&gt;all();
    if (empty($colours)) {
        return;
    }

    $event-&gt;fieldData['productColours'] = ArrayHelper::getColumn($colours, 'title');
});
</code></pre>
<p>You will also need to add</p>
<pre><code>use craft\commerce\events\CustomizeProductSnapshotDataEvent;
</code></pre>

CC BY-SA 4.0
2021-01-06T12:36:42.333Z
2021-01-06T12:36:42.333Z
Green17
<p>How would I add more information (custom fields) to a variant's snapshot?</p>

<p>The custom field I'm adding will change over time, but I need it to stay consistent on invoices etc. </p>

<plugin-craftcommerce>
Add custom fields to variant snapshot
# Add custom fields to variant snapshot

(Asked by: username_0 on 2017-04-25)

How would I add more information (custom fields) to a variant's snapshot?

The custom field I'm adding will change over time, but I need it to stay consistent on invoices etc.

**Tags:** plugin-craftcommerce

---

## 2 answers

### Answer by username_1 on 2017-04-25. Score: 5 | Accepted answer

Yes using the onPopulateLineItem event. Something like this should work:
craft()->on('commerce_lineItems.onPopulateLineItem', function($event){

    $purchasable = $event->params['purchasable'];
    $lineItem = $event->params['lineItem'];

    $lineItem->options = array_merge(
      $lineItem->options,
      ['customFieldLabel'=>$purchasable->customField]
    );

});


---

### Answer by username_2 on 2021-01-06. Score: 2

For Craft 3 Nathaniel from Pixel & Tonic helped us with the below:
In the following example, I am adding the titles of a category relationship field productColours to the snapshot but only for the products in the product type of clothing.
// Modify product snapshot
Event::on(Variant::class, Variant::EVENT_AFTER_CAPTURE_PRODUCT_SNAPSHOT, function(CustomizeProductSnapshotDataEvent $event) {
    $variant = $event->sender;
    if (!$variant instanceof Variant) {
        return;
    }

    $product = $variant->getProduct();
    if (!$product || $product->type->handle != 'clothing') {
        return;
    }

    $colours = $product->productColours->all();
    if (empty($colours)) {
        return;
    }

    $event->fieldData['productColours'] = ArrayHelper::getColumn($colours, 'title');
});

You will also need to add
use craft\commerce\events\CustomizeProductSnapshotDataEvent;


---

