Choosing which Products to import on Magento 2
Platforms:
Per standard, the Magento 2 extension only imports products that are in stock and saleable.
This can be changed if needed.
Including out-of-stock products or with specific visibilities
In the Magento 2 backend, go to Stores->Configuration->Clerk->Configuration.
Under Product Synchronization you have two options for choosing the products to import:
Only synchronize saleable products lets you choose whether to send products that cannot be purchased, but still shown
Only synchronize product with visibility lets you choose a specific visibility that the products should have
After making your changes, click Save Config.
If you do this, we strongly recommend that you also add an extra attribute to Magento 2, which indicates when a product is not saleable, so you can show it in your Design.
Assuming you create an attribute called is_saleable which is either true or false, you can use it like this in Designs:
{% raw %}
{% if product.is_saleable %}
<div class="in-stock">In Stock</div>
{% else %}
<div class="not-in-stock">Not In Stock</div>
{% endif %}
{% endraw %}
Then go to my.clerk.io -> Data Sync and click Start Sync to sync with the new rules.
Adding custom rules
The following file controls which products are imported to Clerk.io:
vendor->clerk->magento2->Model->Adapter->Product.php
In the bottom of this file, locate the function called prepareCollection().
If needed, you can add advanced rules to this function, to control which products to send to us:
Then go to my.clerk.io -> Data and click Start Full Data Sync to sync with the new rules.