Per standard, Magento uses Configurable Products to handle main-products and variants. The Clerk.io extension has been made to support this, as it is the best-practice for Magento.
However, if you have setup your Variants using Grouped Products, your sales-tracking will not work, since you will be tracking ID's of products, that Clerk.io has not imported from your Magento webshop. This is because Variants usually are not visible.
Clerk.io will not be able to see connections between products, when they are not imported:
For Clerk.io, it usually doesnt matter which variant is purchased, as long as "main" product it belongs to is tracked.
To fix this, you need to change 2 files in the extension, to match your setup.
1. The Sales-Tracking
The file that generates the sales-tracking data, is this:
In this file, usually around line 65, the following piece of code is used to get the ID of the product that has been purchased:
This needs to be changed, so no matter which grouped product variant has been purchased, its always the ID of the "main" product that is sent.
2. The Imported Orders
The same process needs to be done for the previous orders that are imported so we know which "main" products have previously been purchased.
This file handles it:
Around line 44, in the function orderFormatter($order) the ID of the product is sent from Magento:
Change this to the same logic as the sales-tracking.
3. Check if your changes work
Now, go to my.clerk.io -> Data and click Start New Data Sync to import the newest data:
Proceed to place a test-order where you purchase a product that has variants.
Afterwards, go to Tracked Orders and check the order you just placed. If you can see the Main products in the order, including their name and image, your code works: