php - How to output added to cart messsage or add to cart error on the current page Woocommerce? -
how output added-to-cart messages or add cart error message on current page woocommerce after add-to-cart button had been fired? since error messages usally redirected in class-wc-cart.php? because allowed add cart button on content-product.php page. code of redirect after add car on class-wc-cart ajax this:
// if there error adding cart, redirect product page show errors $data = array( 'error' => true, 'product_url' => apply_filters( 'woocommerce_cart_redirect_after_error', get_permalink( $product_id ), $product_id ) );// it's redirect link individual product page wp_send_json( $data );
the website link is: http://gotheelz.com
try changing settings of woocommerce,
woocommerce > settings > products > display tab > add cart behaviour -- untick redirect cart page after successful addition , [✓] enable ajax add cart buttons on archives.
this solution worked me. let me know if same worked you.
Comments
Post a Comment