ajax response add to cart and remove / return html code page
-
I find a little problems with performance in woocommerce.
My button add/remove to cart after click send request to backend vie ajax and return html page.add_filter( 'woocommerce_add_to_cart_redirect', 'my_add_to_cart_redirect' ); function my_add_to_cart_redirect( $url ) { if ( isset( $_REQUEST['add-to-cart'] ) && ! empty( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest' ) { // If get response vie AJAX, return JSON $response = array( 'status' => true ); wp_send_json( $response ); } else { } }
With this code i have next result
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘ajax response add to cart and remove / return html code page’ is closed to new replies.