I'm trying to setup a small "added to cart" modal confirmation and keep the visitor on the same page. Similar to the functionality of the sidecart, but with some product recommendations and information added in.
I'm mostly there, but I'd like some feedback on some behavior I'm seeing.
With the cart type set to custom, an add to cart button correctly fires the request and does not redirect me to the cart page.
Clicking a http://storeurl/cart?cart=checkout
link correctly forwards to store checkout.
Clicking a http://storeurl/cart?cart=view
results in a twig render log and I assume a callback trigger firing, but it does not redirect to the cart.
That behavior seems correct, calling cart=view with a custom build would assume I wanted to parse the cart data in the page and not visit the cart itself.
Setting cart type to full page results in slightly different, but expected behavior.
cart=view & cart=checkout links work correctly and redirect. But cart=add links forward me to the cart page (as expected). If i catch them in the 'cart-submit' event and call next(false) it prevents the redirect, but the product is not added.
That also seems correct, but not exactly what I need.
My two solutions are to either
Set carttype = custom, catch the cart-submit event for cart=view and manually set window.location.href= storeurl/cart?cart=view+sessiondata to trigger the redirect.
Set carttype = fullpage, catch the cart-submit event for cart=add, call next(false) and then submit a FC.client.request with the full product url params.
Both seem to work, I'm curious if either is a bad idea or if there is an easier way to force the redirect on the cart=view links with the custom cart setting.