duncanmcclean / simple-commerce

A simple, yet powerful e-commerce addon for Statamic.
https://statamic.com/addons/duncanmcclean/simple-commerce
Other
147 stars 41 forks source link

Coupon Minimum Cart Value Doesnt Validate Properly #816

Closed okimann closed 1 year ago

okimann commented 1 year ago

Description

I've done a clean install of the Simple Commerce starter kit and added a coupon that requires a Minimum Cart Value of $600. At payment my cart is $15 but i can still use the coupon and get a discount. {{ sc:cart:itemsTotal }} returns $15 and {{ sc:coupon:minimum_cart_value }} returns $600.

Steps to reproduce

  1. Install simple-commerce
  2. Add a coupon code for a high value
  3. Checkout with a value lower than the coupon
  4. Enter the coupon code
  5. Receive the discount anyway, no error thrown.

Environment

Environment Application Name: Statamic Laravel Version: 9.50.2 PHP Version: 8.1.15 Composer Version: 2.4.4 Environment: local Debug Mode: ENABLED URL: simple-commerce.test Maintenance Mode: OFF

Cache Config: NOT CACHED Events: NOT CACHED Routes: NOT CACHED Views: CACHED

Drivers Broadcasting: log Cache: statamic Database: mysql Logs: stack / single Mail: smtp Queue: sync Session: file

Simple Commerce Currencies: GBP Gateways: Dummy Repository: Customer: DoubleThreeDigital\SimpleCommerce\Customers\EntryCustomerRepository Repository: Order: DoubleThreeDigital\SimpleCommerce\Orders\EntryOrderRepository Repository: Product: DoubleThreeDigital\SimpleCommerce\Products\EntryProductRepository Shipping Methods: Standard Post Tax Engine: DoubleThreeDigital\SimpleCommerce\Tax\BasicTaxEngine

Statamic Addons: 1 Antlers: runtime Stache Watcher: Enabled Static Caching: Disabled Version: 3.4.2 PRO

Statamic Addons doublethreedigital/simple-commerce: 4.5.3

duncanmcclean commented 1 year ago

I tried to reproduce this bug but spotted a different issue with code responsible for creating/updating coupons in the Control Panel. I'm not 100% sure if it'll fix this for you but it's worth a go...

Could you please try updating to Simple Commerce v4.5.4, then delete & re-create the coupon in the Control Panel?

Could you let me know if you still run into the issue after doing that or not?

okimann commented 1 year ago

Hi, i upgraded to 4.5.4 and now it works perfectly, thanks!