Skip to content

Commit a81280c

Browse files
committed
rate limit option
1 parent eeec81c commit a81280c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/controllers/CartController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use craft\elements\User;
2020
use craft\errors\ElementNotFoundException;
2121
use craft\errors\MissingComponentException;
22+
use craft\helpers\App;
2223
use craft\helpers\Json;
2324
use craft\helpers\StringHelper;
2425
use craft\helpers\UrlHelper;
@@ -95,7 +96,7 @@ public function behaviors(): array
9596
'cart-by-number' => [
9697
'class' => RateLimit::class,
9798
'limit' => 1,
98-
'window' => 1,
99+
'window' => (float)App::env('CRAFT_COMMERCE_CART_RATE_LIMIT_WINDOW') ?: 0.5,
99100
// Only apply rate limiting when a cart number is explicitly passed
100101
'active' => function(Context $context, $rateLimitId) {
101102
return $context->request->getBodyParam('number') || $context->request->getQueryParam('number');

0 commit comments

Comments
 (0)