Free & Open Source v1.0.1 Magento 2.4.x, PHP 8.1+

Customer Segmentation for Magento 2

Dynamic customer segments based on attributes, order history, cart data, and behavior. Visual rule builder, cart price rule integration, and REST API — the Adobe Commerce feature, free for Community Edition.

View on GitHub composer require magendoo/module-customer-segment

Features

Dynamic Segments

Automatically assign customers to segments based on rules. Segments update in real-time on customer events, on a cron schedule, or manually — you choose per segment.

Visual Rule Builder

Build complex conditions visually in the admin — combine customer attributes, order history, cart data, and product interactions with AND/OR logic. No code required.

20+ Condition Types

Segment by email, name, DOB, gender, group, total orders, revenue, AOV, first/last order date, cart subtotal, viewed categories, purchased products, wishlist items, and more.

Cart Price Rule Integration

Use segments directly in Magento's cart price rules — target promotions to VIP customers, first-time buyers, high-AOV segments, or dormant accounts without custom code.

REST API

Full CRUD for segments plus customer-segment lookup. Create, update, refresh segments, and query which segments a customer belongs to — all via API.

CLI Commands

Refresh specific segments or all active segments from the command line. Export segment customers to CSV. Integrate with deployment pipelines and cron jobs.

Preview & Matched Customers

Preview which customers match a segment's conditions before saving. The 'Matched Customers' tab shows all assigned customers with export capability.

Security Tested

106 unit tests with 198 assertions. CSV injection prevention, formula injection protection, condition type allowlisting, and arbitrary class instantiation prevention.

Screenshots

Customer Segments Grid
Admin — Manage all customer segments with status, customer count, and mass actions
Customer Segment Editor
Admin — Visual rule builder with conditions and customer matching preview

Use Cases

  • VIP customer programs — segment by total revenue or order count for exclusive promotions
  • Win-back campaigns — identify dormant customers by last order date
  • Cart abandonment targeting — segment customers with active carts above a threshold
  • First-time buyer promotions — target customers with zero order history
  • Geographic segmentation — combine shipping country with purchase behavior
  • B2B tiering — segment by revenue brackets for tiered pricing via cart rules
  • Product affinity — segment customers who purchased from specific categories

Installation

Install via Composer

composer require magendoo/module-customer-segment
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy -f
bin/magento cache:flush

Getting Started

  1. Navigate to Customers → Customer Segments
  2. Click Add New Segment
  3. Set the name, status (Active), and refresh mode (Cron recommended)
  4. Open the Conditions tab and build your rules
  5. Save and click Refresh Segment Data
  6. Check the Matched Customers tab to verify

Refresh Modes

ModeDescription
ManualAdmin clicks refresh button to update
CronUpdated automatically on schedule (default: daily 2 AM)
Real-timeUpdated on customer events (login, order, cart change)

CLI Commands

# Refresh specific segment(s)
bin/magento magendoo:customer-segment:refresh 1 2 3

# Refresh all active segments
bin/magento magendoo:customer-segment:refresh --all

# Export segment customers to CSV
bin/magento magendoo:customer-segment:refresh 1 --export --format=csv

REST API

MethodEndpointDescription
GET/V1/customer-segmentsList all segments
GET/V1/customer-segments/:idGet segment by ID
POST/V1/customer-segmentsCreate new segment
PUT/V1/customer-segments/:idUpdate segment
DELETE/V1/customer-segments/:idDelete segment
POST/V1/customer-segments/:id/refreshRefresh segment data
GET/V1/customers/:customerId/segmentsGet customer's segments

Need help with installation or customization?

Every module is built for production, but every store is different. If you need integration, customization, or enterprise support — let's talk.

Get in Touch GitHub
22+ Years in Commerce Engineering
50+ Enterprise Magento Projects
EU Based in Europe, Serving Europe
OSS Open Source Contributor
Get a Proposal • 24h response Call