PHPackages                             schrammel-codes/magento2-salesrule - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. schrammel-codes/magento2-salesrule

ActiveMagento2-module[Utility &amp; Helpers](/categories/utility)

schrammel-codes/magento2-salesrule
==================================

Adds duplicate functionality and mass actions to Cart Price Rules

1.2.0(2mo ago)1877↓87.9%1MITPHPPHP ^8.1

Since Jan 26Pushed 2mo agoCompare

[ Source](https://github.com/schrammel-codes/magento2-salesrule)[ Packagist](https://packagist.org/packages/schrammel-codes/magento2-salesrule)[ RSS](/packages/schrammel-codes-magento2-salesrule/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (3)Dependencies (4)Versions (7)Used By (1)

SchrammelCodes\_SalesRule
=========================

[](#schrammelcodes_salesrule)

Streamline your promotional rule management with powerful duplication and mass management features for Magento 2 Cart Price Rules.

 [![Supported Magento Versions](https://camo.githubusercontent.com/2113b3a30955562f026a2b7dda3a09fee30d0c49aacbfce67193c5dc7b434617/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d6167656e746f2d322e342d627269676874677265656e2e7376673f6c6f676f3d6d6167656e746f266c6f6e6743616368653d74727565267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/2113b3a30955562f026a2b7dda3a09fee30d0c49aacbfce67193c5dc7b434617/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d6167656e746f2d322e342d627269676874677265656e2e7376673f6c6f676f3d6d6167656e746f266c6f6e6743616368653d74727565267374796c653d666c61742d737175617265) [![Latest Stable Version](https://camo.githubusercontent.com/45b72ba5c72f64bd1b58a0cab0a89ec56a448618e8da151491009f651adc6432/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73636872616d6d656c2d636f6465732f6d6167656e746f322d73616c657372756c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/schrammel-codes/magento2-salesrule) [![Composer Downloads](https://camo.githubusercontent.com/0a9ee20aa715b9dffc4bf9b5c97c2fdc6b1f99f1afe0b3c01474cb00b63ec217/68747470733a2f2f706f7365722e707567782e6f72672f73636872616d6d656c2d636f6465732f6d6167656e746f322d73616c657372756c652f646f776e6c6f616473)](https://packagist.org/packages/schrammel-codes/magento2-salesrule) [![Maintained - Yes](https://camo.githubusercontent.com/04aba48520e6322ebc6c41b7995626a88ce408bd46ec4eb15ae474936b345276/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d61696e7461696e65642533462d7965732d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/schrammel-codes/magento2-salesrule/graphs/commit-activity) [![License - MIT](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://opensource.org/licenses/MIT)

What This Module Does
---------------------

[](#what-this-module-does)

This module extends Magento 2's Cart Price Rules (promotional discounts) with convenient management features that save time and reduce errors when managing multiple similar promotions.

### Key Features

[](#key-features)

**1. Duplicate Cart Price Rules**

Create copies of existing promotional rules with a single click. Perfect for:

- Creating seasonal variations of successful promotions
- Setting up similar rules for different customer segments
- Testing rule variations without risking the original configuration

**2. Enhanced Grid**

The Cart Price Rules grid gets three additional columns at a glance:

- **Rule Type**: The discount type (e.g. Fixed, Percent, Buy X Get Y)
- **Discount Amount**: The configured discount value
- **Stop Rule Processing**: Whether this rule stops further rules from applying

Each row also gains an inline **Duplicate** shortcut in its Actions column.

[![additional-grid-columns.png](docs/additional-grid-columns.png)](docs/additional-grid-columns.png)

**3. Mass Actions**

Manage multiple rules at once:

- **Mass Duplicate**: Copy several rules simultaneously
- **Mass Delete**: Remove multiple outdated rules in one action
- **Mass Status Change**: Enable or disable multiple rules at once

### How It Works

[](#how-it-works)

#### Smart Duplication

[](#smart-duplication)

When you duplicate a rule, the module:

- ✅ Copies all rule conditions and actions
- ✅ Adds "(Copy)" suffix to the rule name *(overridable via Custom Fields configuration — see below)*
- ✅ Keeps original active/inactive status *(configurable — can force enabled or disabled)*
- ✅ Copies customer group associations *(configurable)*
- ✅ Copies website assignments *(configurable)*
- ✅ Copies store-specific labels *(configurable)*
- 🔄 Resets coupon code *(always reset, cannot be overridden by configuration)*
- 🔄 Resets usage counter to zero *(always reset, cannot be overridden by configuration)*
- 🔄 Clears start and end dates *(always reset, cannot be overridden by configuration)*
- 🔄 Generates a new rule ID automatically *(always reset, cannot be overridden by configuration)*
- 🔄 Resets custom fields configured via **Stores &gt; Configuration &gt; SchrammelCodes &gt; Sales Rule** *(configurable)*

This ensures your duplicated rules are ready to customize without inheriting usage history or active date ranges.

#### Traceability

[](#traceability)

Duplicated rules display a read-only **"Duplicated From"** hint on their edit page, showing the ID of the original rule. On Adobe Commerce installations with staging enabled, the module resolves the staging `row_id` back to the human-readable `rule_id` of the original rule so the reference stays meaningful across staging versions.

[![duplicated-from-commerce.png](docs/duplicated-from-commerce.png)](docs/duplicated-from-commerce.png)

Benefits for Store Administrators
---------------------------------

[](#benefits-for-store-administrators)

### Time Savings

[](#time-savings)

Instead of manually recreating complex promotional rules with dozens of conditions, duplicate existing ones and adjust only what's needed. A task that might take 15-20 minutes now takes seconds.

### Consistency

[](#consistency)

Duplicating rules ensures all settings, conditions, and actions are copied exactly, reducing human error when creating similar promotions.

### Flexibility

[](#flexibility)

Quickly test variations of successful promotions or create region-specific versions of global campaigns without starting from scratch.

### Efficiency

[](#efficiency)

Mass actions let you manage multiple rules at once - perfect for seasonal cleanup, enabling holiday promotions, or deactivating expired campaigns.

Usage Guide
-----------

[](#usage-guide)

### Duplicate a Single Rule

[](#duplicate-a-single-rule)

[![action-dropdown.png](docs/action-dropdown.png)](docs/action-dropdown.png)

1. Navigate to **Marketing &gt; Promotions &gt; Cart Price Rules**
2. Find the rule you want to duplicate
3. Click **Select** in the Actions column
4. Choose **Duplicate**
5. The duplicated rule appears in the grid with "(Copy)" appended to its name

[![duplicated-rule.png](docs/duplicated-rule.png)](docs/duplicated-rule.png)

### Duplicate from Rule Edit Page

[](#duplicate-from-rule-edit-page)

[![duplicate-on-edit.png](docs/duplicate-on-edit.png)](docs/duplicate-on-edit.png)

1. Open any Cart Price Rule for editing
2. Click the **Duplicate** button (next to Save/Delete)
3. You'll be redirected to the edit page of the newly created copy
4. Customize the copy as needed and save

### Mass Duplicate Multiple Rules

[](#mass-duplicate-multiple-rules)

1. In the Cart Price Rules grid, select checkboxes for rules you want to duplicate
2. Open the **Actions** dropdown (top left of grid)
3. Select **Duplicate**
4. Click **Submit**
5. All selected rules are duplicated at once

### Mass Delete Rules

[](#mass-delete-rules)

1. Select rules to delete using checkboxes
2. Choose **Delete** from the Actions dropdown
3. Confirm the deletion
4. Selected rules are permanently removed

### Mass Status Change

[](#mass-status-change)

1. Select rules to enable or disable
2. Choose **Change Status** from the Actions dropdown
3. Select **Enabled** or **Disabled**
4. Click **Submit**
5. All selected rules are updated immediately

Installation
------------

[](#installation)

```
# Install via Composer
composer require schrammel-codes/magento2-salesrule

# Enable the module
bin/magento module:enable SchrammelCodes_SalesRule

# Run setup upgrade
bin/magento setup:upgrade

# Clear cache
bin/magento cache:clean
```

### Permissions

[](#permissions)

The module adds two ACL resources:

- `SchrammelCodes_SalesRule::quote_duplicate` - Permission to duplicate cart price rules
- `SchrammelCodes_SalesRule::config` - Permission to manage the module configuration

Grant these permissions to admin roles as needed.

Compatibility
-------------

[](#compatibility)

- **Magento 2.4.x** (Open Source and Adobe Commerce)
- **PHP 8.1+**

> **Adobe Commerce note:** When `Magento_SalesRuleStaging` is enabled, staging version fields are automatically reset on duplication — no companion module required.

Duplication Configuration
-------------------------

[](#duplication-configuration)

All duplication behaviour is configurable via **Stores &gt; Configuration &gt; SchrammelCodes &gt; Sales Rule &gt; Duplication Settings**.

[![configuration-options.png](docs/configuration-options.png)](docs/configuration-options.png)

### Relationship Copying

[](#relationship-copying)

Control whether each type of association is carried over to the duplicate:

SettingDefaultDescription**Duplicate Active Status**Keep as isSet the active/inactive status of duplicated rules: keep the original value, always disable, or always enable**Copy Website Associations**YesCopy which websites the rule is assigned to**Copy Customer Group Associations**YesCopy which customer groups the rule applies to**Copy Store Labels**YesCopy store-specific rule name translationsSet any of these to **No** if you prefer the duplicate to start without those associations, requiring you to assign them explicitly.

### Custom Fields to Reset

[](#custom-fields-to-reset)

Some Magento installations add extra columns to the `salesrule` database table (for example, fields added by custom modules or third-party integrations). By default, these columns are copied verbatim when a rule is duplicated.

The **Custom Fields to Reset on Duplication** table lets you declare which columns should be reset instead:

ColumnDescription**Field Name (DB Column)**The exact column name in the `salesrule` table**Reset Value (leave empty for "NULL")**The value to set on the duplicate. Leave empty to reset to `NULL`.Click **Add Field** to add a row, then **Save Config**.

#### Example

[](#example)

To reset a custom field called `my_custom_field` to `NULL` on every duplication:

Field NameReset Value`my_custom_field`*(empty)*To reset it to a fixed placeholder value instead:

Field NameReset Value`my_custom_field``PENDING`#### Overriding the rule name suffix

[](#overriding-the-rule-name-suffix)

By default, duplicated rules get `" (Copy)"` appended to their name. You can override this by adding `name` as a custom field reset:

Field NameReset Value`name`*(empty — sets name to NULL)*`name``My Custom Suffix`> **Note:** The reset value replaces the entire name, not just the suffix. If you want a custom suffix you will need to set a static value; dynamic name construction is not supported.

#### Fields that are always reset

[](#fields-that-are-always-reset)

The following fields are unconditionally reset on every duplication and **cannot be overridden** by this configuration, even if you add them to the table above:

FieldAlways reset to`rule_id`*(new auto-generated ID)*`from_date``NULL``to_date``NULL``coupon_code``NULL``times_used``0`> **Adobe Commerce only:** When `Magento_SalesRuleStaging` is active, the fields `created_in`, `updated_in`, and `deactivated_in` are also unconditionally reset to their default staging version values.

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance85

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~41 days

Total

3

Last Release

78d ago

PHP version history (2 changes)1.0.0PHP ~8.1.0||~8.2.0||~8.3.0

1.2.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/e54f6b54d30204518e69b61769d11fee324a30a0e48446d300e92ab4628bb0e9?d=identicon)[aschrammel](/maintainers/aschrammel)

---

Top Contributors

[![aschrammel](https://avatars.githubusercontent.com/u/1203434?v=4)](https://github.com/aschrammel "aschrammel (14 commits)")

### Embed Badge

![Health badge](/badges/schrammel-codes-magento2-salesrule/health.svg)

```
[![Health](https://phpackages.com/badges/schrammel-codes-magento2-salesrule/health.svg)](https://phpackages.com/packages/schrammel-codes-magento2-salesrule)
```

###  Alternatives

[mollie/magento2

Mollie Payment Module for Magento 2

1131.9M16](/packages/mollie-magento2)[nosto/module-nostotagging

Increase your conversion rate and average order value by delivering your customers personalized product recommendations throughout their shopping journey.

27703.7k4](/packages/nosto-module-nostotagging)[smile/module-gift-sales-rule

Extension of Magento2 Sales Rule to provide gifted (free) products.

35124.3k2](/packages/smile-module-gift-sales-rule)[myparcelnl/magento

A Magento 2 module that creates MyParcel labels

1860.2k](/packages/myparcelnl-magento)[loki/magento2-components

Core module for defining Alpine.js components with advanced AJAX features

1011.8k26](/packages/loki-magento2-components)[zwernemann/module-withdrawal

Magento 2 EU Withdrawal Button Module - Adds a withdrawal/revocation button for orders in compliance with EU Directive (EU) 2023/2673

244.9k2](/packages/zwernemann-module-withdrawal)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
