<p>I faced the <a href="https://craftcms.stackexchange.com/questions/33997/additional-criteria-to-filter-status-of-field-passed-into-relatedto">same problem</a> in Craft v3.4.10 and have been informed that this is a <a href="https://github.com/craftcms/cms/issues/5849" rel="nofollow noreferrer">bug</a>, which has now been fixed and will be shipped in v3.4.12.</p>

CC BY-SA 4.0
2020-03-29T10:49:02.427Z
2020-03-29T10:49:02.427Z
Archit Chandra
<p>I need to search for all commerce variants related to a custom element "Account".</p>

<p>The account element is related to a variant through a matrix field with handle<br>
<code>varientaccountmapping</code>, block handle <code>mapping</code> field handle <code>account</code></p>

<pre><code>{% set allowedVarients = craft.variants().relatedTo({
    targetElement: accountElement,
    field: 'varientaccountmapping.account'
}).all() %}
</code></pre>

<p>works, however it returns results whether the matrix block is enabled or disabled - ignoring the status.</p>

<p>How can I get this to return only results where the matrix block it is related to is <strong>enabled</strong>?</p>

<craft3><relations><relatedto>
RelatedTo relation - checking matrix block status is enabled
# RelatedTo relation - checking matrix block status is enabled

(Asked by: username_0 on 2019-02-14)

I need to search for all commerce variants related to a custom element "Account".
The account element is related to a variant through a matrix field with handle
varientaccountmapping, block handle mapping field handle account
{% set allowedVarients = craft.variants().relatedTo({
    targetElement: accountElement,
    field: 'varientaccountmapping.account'
}).all() %}

works, however it returns results whether the matrix block is enabled or disabled - ignoring the status.
How can I get this to return only results where the matrix block it is related to is enabled?

**Tags:** craft3, relations, relatedto

---

## 1 answers

### Answer by username_1 on 2020-03-29. Score: 2 | Accepted answer

I faced the [same problem](https://craftcms.stackexchange.com/questions/33997/additional-criteria-to-filter-status-of-field-passed-into-relatedto) in Craft v3.4.10 and have been informed that this is a [bug](https://github.com/craftcms/cms/issues/5849), which has now been fixed and will be shipped in v3.4.12.


---

