<p>Worked it out!</p>
<p>Putting this in a custom module should do the trick..., obviously changing the price modifier and option name to your needs.</p>
<pre><code>        Event::on(
            LineItems::class,
            LineItems::EVENT_POPULATE_LINE_ITEM,
            function(LineItemEvent $event) {
                // @var LineItem $lineItem
                $lineItem = $event-&gt;lineItem;
                // @var bool $isNew
                $isNew = $event-&gt;isNew;

                if (isset($lineItem-&gt;options['giftWrapped']) &amp;&amp; $lineItem-&gt;options['giftWrapped'] == 'yes') {
                    $lineItem-&gt;price += 20;
                }
            }
        );
</code></pre>

CC BY-SA 4.0
2020-08-14T14:37:35.947Z
Yeh that's the way I'd do it, too. Feel free to set this as the accepted answer if you'd like.
RitterKnight
CC BY-SA 4.0
2021-08-03T19:55:11.637Z
Hi @GlennJ; i tried your code, i need something similar. but in my cart it decreases the price with 20, but then makes a sale and reduces the price again with 20. So in the end the price stays the same. Did something change in between or do i have to add something special here? i use the template "giftWrapped" checkbox. thanks for your help!
Henrik
CC BY-SA 4.0
2020-08-14T14:25:34.537Z
2020-08-14T14:25:34.537Z
GlennJ
<p>My client wishes to sell artwork online. They're all one-off pieces and once one is sold, it should not be available to purchase thereafter.</p>
<p>However, the artwork needs to have an option to be framed which would increase the price.</p>
<p>I can't see how this can be achieved with Variants as each variant has their own stock level.</p>

<craft3><plugin-craftcommerce3>
Craft Commerce Product Options that increase price, but do NOT affect stock
# Craft Commerce Product Options that increase price, but do NOT affect stock

(Asked by: username_0 on 2020-08-14)

My client wishes to sell artwork online. They're all one-off pieces and once one is sold, it should not be available to purchase thereafter.

However, the artwork needs to have an option to be framed which would increase the price.

I can't see how this can be achieved with Variants as each variant has their own stock level.

**Tags:** craft3, plugin-craftcommerce3


---

## 1 answers

### Answer by username_0 on 2020-08-14. Score: 2 | Accepted answer

Worked it out!
Putting this in a custom module should do the trick..., obviously changing the price modifier and option name to your needs.
        Event::on(
            LineItems::class,
            LineItems::EVENT_POPULATE_LINE_ITEM,
            function(LineItemEvent $event) {
                // @var LineItem $lineItem
                $lineItem = $event->lineItem;
                // @var bool $isNew
                $isNew = $event->isNew;

                if (isset($lineItem->options['giftWrapped']) && $lineItem->options['giftWrapped'] == 'yes') {
                    $lineItem->price += 20;
                }
            }
        );

> **Comments:**
> **username_1**: Yeh that's the way I'd do it, too. Feel free to set this as the accepted answer if you'd like.  
> **username_2**: Hi @username_0; i tried your code, i need something similar. but in my cart it decreases the price with 20, but then makes a sale and reduces the price again with 20. So in the end the price stays the same. Did something change in between or do i have to add something special here? i use the template "giftWrapped" checkbox. thanks for your help!  

---

