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

setting a discount for each item in the cart #301

Closed
Augen2203 opened this issue Aug 5, 2021 · 1 comment
Closed

setting a discount for each item in the cart #301

Augen2203 opened this issue Aug 5, 2021 · 1 comment
Labels

Comments

@Augen2203
Copy link

Augen2203 commented Aug 5, 2021

Can I add a discount separately, for each product added to the cart?

For example like this:$cart->setDiscount($cartItem->itemHash, $product->Discount)

For example, I have a product that now has a 10% discount.

In the general field there is a discount.

Also, display a discount for each item in the basket (both a discount for the product itself and a discount with the applied coupon).

Thanks to.

@lukepolo
Copy link
Owner

lukepolo commented Oct 4, 2021

You can add a coupon for each item , and for the entire cart.

Whole Cart

 $fixedCoupon = new LukePOLO\LaraCart\Coupons\Fixed('500 OFF', 500);
LaraCart::addCoupon($fixedCoupon);

Per Item

 $fixedCoupon = new LukePOLO\LaraCart\Coupons\Fixed('10OFF', 10);
 $fixedCoupon->setDiscountOnItem($item);

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