You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to make cross-sells and upsells addable to the cart while viewing the cart.
Documentation and other existing themes I've found only show how to do so while on a product page, using shop:onAddToCart.
Having initially tried that, I was finding that trying to reload the cart-page partial afterwards would result in nothing at all being shown in the cart until the user reloads the page. I contacted support and received this response:
Hey Marc,
I changed the data-ajax-handler from shop:onAddToCart to shop:cart.
Reasons for this:
It also handles upsell card adds, given the upsellId and productId parameters.
It yields cart variables, which are rendered in the temlaplates you specified.
shop:onAddToCart does not offer these variables in rendering the requested templates.
This should now work - please test to confirm, and let me know if you have any questions.Thanks,Andy
--
This does indeed work, but at the time I was only trying to provide upsells on the cart page. Now that I'm also trying to provide cross-sells, I'm finding that sending the request with shop:cart doesn't seem to work on either the product page OR the cart page. The product simply isn't added to the cart.
Suggestions?
The text was updated successfully, but these errors were encountered:
Trying to make cross-sells and upsells addable to the cart while viewing the cart.
Documentation and other existing themes I've found only show how to do so while on a product page, using shop:onAddToCart.
Having initially tried that, I was finding that trying to reload the cart-page partial afterwards would result in nothing at all being shown in the cart until the user reloads the page. I contacted support and received this response:
This does indeed work, but at the time I was only trying to provide upsells on the cart page. Now that I'm also trying to provide cross-sells, I'm finding that sending the request with shop:cart doesn't seem to work on either the product page OR the cart page. The product simply isn't added to the cart.
Suggestions?
The text was updated successfully, but these errors were encountered: