- How do I install binafy/laravel-discount in a Laravel application?
- Install it with Composer by running composer require binafy/laravel-discount. Laravel's package auto-discovery should register the service provider, but confirm any publish steps for configuration or migrations in the README. After that you can start defining discounts and applying them in your checkout or cart flow.
- What types of discounts can I create with Laravel Discount?
- Laravel Discount supports percentage discounts, fixed amount discounts, Buy X Get Y deals, tiered discounts, free shipping, and conditional discounts. It also handles discount codes, expiry dates, usage limits, and stackable discounts. That covers common promotional, seasonal sale, and coupon workflows.
- Can discount codes have expiry dates and usage limits?
- Yes. You can generate and manage discount codes, set expiration dates for time-limited offers, and restrict how many times a discount can be used. These controls are useful for campaigns, launch promotions, and preventing code abuse.
- Does Laravel Discount support stacking multiple discounts?
- Yes, the package supports stackable discounts, letting you allow multiple discounts to apply at the same time or restrict stacking. You should still test combinations to confirm the final total, free shipping, and tiered rules behave as intended.
- How do conditional discounts work, such as minimum order value or category rules?
- Conditional discounts let you attach rules such as a minimum order value or specific product categories, so a discount only applies when those conditions are met. They can be combined with percentage or fixed amount discount types. The package documentation will show how to define and evaluate these conditions in your application.
- Which Laravel and PHP versions are supported by binafy/laravel-discount?
- The README shows a PHP Version Require badge and Packagist version badge, so check Packagist or the package's composer.json for the exact PHP and laravel/framework constraints. Laravel packages declare framework support there, which is the reliable way to confirm compatibility with older or newer Laravel releases. If your app uses an older Laravel version, verify the constraint before installing.
- Can I apply Laravel Discount to a Laravel shopping cart?
- Yes, the README lists support for Laravel Cart, so the package is intended to work with cart totals rather than only standalone order models. You define discounts and apply them during cart or checkout calculation. Check the documentation for the exact cart integration methods and expected data structures.
- How do tiered discounts work in Laravel Discount?
- Tiered discounts grow the discount as the order total increases, such as 5 percent over 1,000,000 and 10 percent over 5,000,000. This lets you reward larger baskets without creating separate codes for each threshold. Configure the tiers to match your pricing rules and test the boundary values.
- What should I check before using Laravel Discount in production?
- Confirm that expiry dates and usage limits match your business rules, especially for limited-use codes where concurrent checkouts can race. Test stackable discount combinations to ensure totals and free shipping are calculated in the order you expect. Also verify the package version against your Laravel and PHP constraints and run your own checkout tests.
- What are alternatives to binafy/laravel-discount for handling discounts in Laravel?
- If you only need a single coupon field, custom code may be enough; Laravel Discount is useful when you need percentage, fixed, tiered, Buy X Get Y, free shipping, and stackable rules. Compare it with other Laravel coupon or promotion packages by checking supported discount types, Laravel version constraints, test coverage, and release activity. The package's Packagist badges and GitHub Actions tests help you judge maintenance before adopting it.