【发布时间】:2015-06-23 04:23:05
【问题描述】:
添加到购物车按钮被触发后,如何在当前页面 Woocommerce 上输出添加到购物车消息或添加到购物车错误消息?由于错误消息通常在 class-wc-cart.php 中重定向? 因为我允许在 content-product.php 页面上添加到购物车按钮。 class-wc-cart AJAX 上 add to car 后的重定向代码如下:
// If there was an error adding to the cart, redirect to the product page to show any errors
$data = array(
'error' => true,
'product_url' => apply_filters( 'woocommerce_cart_redirect_after_error', get_permalink( $product_id ), $product_id )
);// it's redirect link to individual product page
wp_send_json( $data );
网站链接是: http://gotheelz.com
【问题讨论】:
标签: php wordpress woocommerce