Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to apply several percentage coupons #314

Closed
t-prod opened this issue Sep 20, 2022 · 7 comments
Closed

Unable to apply several percentage coupons #314

t-prod opened this issue Sep 20, 2022 · 7 comments
Assignees
Labels

Comments

@t-prod
Copy link

t-prod commented Sep 20, 2022

Hi,

I can apply several Percentage coupons on the cart (not on the item).
Only one is supported despite the fact I have config('laracart.multiple_coupons') to true.
How can I achieve to have multiple coupons like this ?

$couponType = '\LukePOLO\LaraCart\Coupons\\'.$discount->getDiscountType();
$coupon = new $couponType($discount->code, $discount->discount_percent / 100, [
    'description' => $discount->code.' '.$discount->discount_percent.' %'
]);
LaraCart::addCoupon($coupon);

Thanks for your help

@t-prod
Copy link
Author

t-prod commented Sep 20, 2022

OK the variable in config/laracart.php with 'multiple_coupons' => true, does not have effect.
The vendor\lukepolo\laracart\src\Cart.php use config helper but I think it's the package's config that it's in use rather than my config file.
Do you have a fix ?

@t-prod
Copy link
Author

t-prod commented Sep 20, 2022

If I comment like this it's working :
image

@lukepolo
Copy link
Owner

think it may be a config option

@t-prod
Copy link
Author

t-prod commented Sep 20, 2022

It's the case in your constructor to get the config variable named multi_coupons. But this one is only from your package and not the config/laracart.php itself. Which solution could we have?

@t-prod
Copy link
Author

t-prod commented Sep 20, 2022

Is there a way to set coupons to each items to make easier order lines with Eloquent?

@lukepolo
Copy link
Owner

looks like it was a bug #319

@lukepolo
Copy link
Owner

you also can set coupons per item but using $item->addCoupon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants