Skip to content

Updating cart using AlpineJS only #1036

Closed Answered by duncanmcclean
rrrrando asked this question in Help
Discussion options

You must be logged in to vote

While Simple Commerce does have a dedicated endpoint to return the cart & its line items (GET !/simple-commerce/cart), it won't include the total_including_tax bit you're after (since it's a tag, not actually part of the augmentation).

If you need that (or any other bits of information not returned by that endpoint), you'd have to make your own controller & route:

// app/Http/Controllers/CartController.php
<?php

namespace App\Http\Controllers;

use DuncanMcClean\SimpleCommerce\Orders\Cart\Drivers\CartDriver;
use Illuminate\Http\Request;

class CartController extends Controller
{
    use CartDriver;

    public function __invoke(Request $request)
    {
        $order = $this->getCart();

…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@rrrrando
Comment options

Answer selected by rrrrando
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants