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

Return this cart item (when adding associate model). #300

Open
Augen2203 opened this issue Aug 5, 2021 · 2 comments
Open

Return this cart item (when adding associate model). #300

Augen2203 opened this issue Aug 5, 2021 · 2 comments

Comments

@Augen2203
Copy link

Hi I started trying to use your package in my application. Thanks.

I would like that when linking the model:

LaraCart::add($product-> id, $product->name,1, $product->price, $cart['options'])->setModel(Product::class);
the currently added item to the cart was returned to us, but this does not happen since setModel () returns null.

Why you need to do a similar design

$cart = LaraCart::add($product-> id, $product->name,1, $product->price, $cart['options'])->setModel(Product::class);
$cart->setModel(Product::class);

Thanks

@lukepolo
Copy link
Owner

lukepolo commented Aug 5, 2021

just needs to return this when I set that model.

@Augen2203
Copy link
Author

There is also a problem with adding two identical products, which should be combined in quantity with each other, but this does not happen, but an error occurs:

"Call to a member function setModel () on null".

The error always appears when adding the same product to the cart a second time.

Thanks

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

No branches or pull requests

2 participants