1

After migration from Magento1 Enterprise to Magento2 Commerce I need to programmatically refresh the customer segments

1 Answer 1

0

I created this method to be used by our post migration command:

public function refreshSegments()
{
    $segments = $this->customerSegmentCollection->create();
    /** @var \Magento\CustomerSegment\Model\Segment $segment */
    foreach ($segments as $segment) {
        echo "Updating: ".$segment->getName()."\r\n";
        $segment->matchCustomers();
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.