woocommerce添加到购物车ajax问题

时间:2022-10-25 10:57:17

Woocommerce is probably working properly but I would like my add to cart on every page to be like the detail/single item page ajax actions.

Woocommerce可能正常工作但我希望我在每个页面上添加到购物车就像细节/单项页面ajax操作。

This is what I want: add to cart -> top of page says successfully added to cart and update total on top. This is how the detail/single item page cart buttons work.

这就是我想要的:添加到购物车 - >页面顶部说成功添加到购物车并更新总数。这是详细/单项页面购物车按钮的工作方式。

Instead of : Currently they add to cart and a view cart button shows successfully on the side instead and not refreshing the total on top.

而不是:目前他们添加到购物车并且视图购物车按钮在侧面成功显示而不是刷新总数。

How can I accomplish this.

我怎样才能做到这一点。

Thank You.

1 个解决方案

#1


0  

If the cart is being updated after you refresh the page, then look at running a refresh after the form submits:

如果在刷新页面后更新购物车,请在表单提交后查看运行刷新:

    onsubmit="setTimeout(function () { window.location.reload(); }, 10)"

#1


0  

If the cart is being updated after you refresh the page, then look at running a refresh after the form submits:

如果在刷新页面后更新购物车,请在表单提交后查看运行刷新:

    onsubmit="setTimeout(function () { window.location.reload(); }, 10)"