laravel
laravel copied to clipboard
added withQuantity method to checkout
added option to set quantities on checkout defaults to 1.
This allows usage:
$request->user()->checkout('variant-id')->withQuantity(5)
This added the array key to the payload
['variant_quantities'] = [
[
'variant_id' => (int) $this->variant,
'quantity' => $quantity,
],
]
I tried this solution, but it didn't work for me. I believe variant_quantities should be an array of objects
...
"variant_quantities": [
{
"variant_id": 1,
"quantity": 10
}
]
...
So, something like that worked.
$this->checkoutData['variant_quantities'] = [
[
'variant_id' => (int) $this->variant,
'quantity' => $quantity,
],
];
@davidsket 's solution works 👍
$this->checkoutData['variant_quantities'] = [
[
'variant_id' => (int) $this->variant,
'quantity' => $quantity,
],
];
i just came for this feature. how do i use this feature rightnow as main repon don't have this merged?
You can use repository directly in composer, or use overrides for specific class. I wouldn't recommend doing it in production.
thanks @davidsket updated!