<p>Yes you can, using the <code>Model::EVENT_DEFINE_RULES</code> Put this in your customer module or plugin.</p>
<pre><code>        use craft\commerce\elements\Variant;
        use craft\base\Model;
       use craft\events\DefineRulesEvent;
        
        Event::on(
            Variant::class,
            Model::EVENT_DEFINE_RULES,
            function(DefineRulesEvent $event) {
                $rules = $event-&gt;rules;
                $rules[] = [['weight'], 'required'];
                $event-&gt;rules = $rules;
            }
        );
</code></pre>

CC BY-SA 4.0
2021-03-18T06:15:37.840Z
2021-03-18T06:15:37.840Z
Dale Ramirez
<p>In Craft Commerce, is it possible to make the product variant weight a required field?</p>
<p>We are using weight to calculate shipping so it would be good if we could make it a required field to ensure that the store admin doesn't forget to enter it.</p>
<p>Thanks</p>

<craft3><plugin-craftcommerce3>
In Craft Commerce, is it possible to make the product variant weight a required field?
# In Craft Commerce, is it possible to make the product variant weight a required field?

(Asked by: username_0 on 2021-03-16)

In Craft Commerce, is it possible to make the product variant weight a required field?

We are using weight to calculate shipping so it would be good if we could make it a required field to ensure that the store admin doesn't forget to enter it.

Thanks

**Tags:** craft3, plugin-craftcommerce3

---

## 1 answers

### Answer by username_1 on 2021-03-18. Score: 3

Yes you can, using the Model::EVENT_DEFINE_RULES Put this in your customer module or plugin.
        use craft\commerce\elements\Variant;
        use craft\base\Model;
       use craft\events\DefineRulesEvent;
        
        Event::on(
            Variant::class,
            Model::EVENT_DEFINE_RULES,
            function(DefineRulesEvent $event) {
                $rules = $event->rules;
                $rules[] = [['weight'], 'required'];
                $event->rules = $rules;
            }
        );


---

