I think your php add_to_cart function not setting cart cookies, you can do this manually by adding this line inside the if condition before
//$added
line
add this line
do_action( 'woocommerce_set_cart_cookies', TRUE );
this will set cart cookies.
Related Posts:
- WordPress Ajax Login without page reload
- JavaScript implementation of Gzip
- Is there a JavaScript API? How to access public and private data in JS?
- wp_set_auth_cookie() doesn’t work in Ajax call
- How to HTML5 FormData Ajax
- How to properly use wp.ajax.post?
- Custom PHP endpoint for a plugin’s AJAX call
- Dynamically changing navigation links (next and previous) via AJAX
- Drag and drop multiple file upload using Ajax WordPress
- How to save Clicks of a download link button while it doesn’t matter if we refresh the page or again login/logout
- Quick Edit: Selected Custom Taxonomy Not Refreshing After Save
- Vue.js + AJAX Shortcode
- Turn jQuery.ajax() request into XMLHttpRequest (vanilla JavaScript)
- fetching via fetch/ajax gutenberg block data from third party
- ajax and nonce when JavaScript is in a seperate file
- admin-ajax.php HTTP400: BAD REQUEST – The request could not be processed by the server due to invalid syntax
- AJAX issue – Uncaught SyntaxError when processing Zip File
- Nonces, AJAX, script variables & security in WordPress
- Extending wp JavaScript base class to make a post request to a custom REST endpoint
- How to localized one js file for different actions?
- WooCommerce: Translation lost on AJAX call in Checkout page [closed]
- wp-admin AJAX with Fetch API is done without user
- Admin Ajax and HTML5 Formdata
- Call javascript function when category was added via ajax
- Populating content dynamically via AJAX and Advanced Custom Fields [closed]
- Help with AJAX front end comment moderation
- How to make custom total price reactive in navigation
- Ajax Modal Flickers When Opened Multiple Times
- Why a strange discrepency between get_current_user_id() when using AJAX versus output of document.cookie?
- Show Post Content with AJAX
- splitting the URL using jQuery
- SSO autologin WordPress + Ajax
- Status 400 for AJAX POST Request with admin-ajax.php
- AJAX Load more on CPT returning random posts
- Refresh Markercluster after ajax call
- WooCommerce Ajax Cart Update Stopped Working
- Making an ajax request from a different domain
- Performance optimization of tree like structure
- Radio buttons live refresh in the customizer
- How can I set cookies on both secure and non-secure origins at the same time?
- Gravity Forms closes my popup on Validation Error [closed]
- Variable Products Being Added to Cart with AJAX on Shop and Category Pages
- Why is wp_localize_script returning false?
- Using admin-ajax prevents regular php form submission
- wp_mail doesn’t work when logged in?
- Hide Load more Ajax button if there is no more users to load or less than the number?
- javascript ajax and nonce
- Making POST request with AJAX returns a 400 error (without jQuery)
- Is there a better way to access transients using javascript
- admin-ajax.php (aborted) error when using jQuery.get
- Replace link with form to pass variables to javascript / ajax
- Ajax page load without reload
- Load page HTML content through AJAX
- How to display contact form 7 form in vanilla js without jquery in frontend
- Get uploaded attachment width & height and attachment ID after upload them
- Get localize of a loaded javascript
- Updating failed. The response is not a valid JSON response. specific to my browser when I include javascript in my html
- Uncaught TypeError: Cannot read properties of undefined (reading ‘message’) [closed]
- Trying to run Javascript on AJAX call
- Refresh checkout fields on add to cart with order bump
- javascript onClick update user_meta from jquery.ajax
- Running JavaScript after using WooCommerce Filter Plugin
- how to make sure js is enabled before executing php function
- Ajax login fails: script sets cookies, but is_user_logged_in() returns false
- How to pass value from ajax to php in no conflict mode?
- woocommerce deposit Form with AJAX and shortcode won’t update but add to previous output
- ERROR while passing data from JS to PHP via AJAX
- Ajax sometimes work and sometimes just don’t work
- AJAX to add to cart multiple products woocommerce
- Download doccument on server rather than clients browser
- Using existing ajax data that is loaded into page
- Javascript output now showing in custom widget
- How to echo a PHP code into WooCommerce variation product?
- Ajax call on class returns old data
- How to safely pass post_id and user_id via AJAX to the backend (prevent user from changing it via JS)?
- Ajax show custom post data form & script
- AJAX form not working, still reloads on submit
- Create a post with REST API and adding a category
- Get post details with pure javascript ajax
- Ajax WordPress pass post URLs
- Jquery wrap permalink in a data-attribute?
- Notify user we would like them to clear their cookie. Provide a working button to clear cookies for user
- Display SOLDOUT text in Dropdowns of Variable Product in WooCommerce [closed]
- Session variables lost during Ajax calls – WordPress – Sage Starter Theme
- ‘Dehighlighting’ navigation once clicked
- Caching for logged in user and Ajax update
- Bad Request when adding new post via ajax form
- AJAX admin Internal 500 error Failed to Upload
- Using Javascript Callback from plugin in a theme
- WooCommerce AJAX cross domain add to cart
- Facebook Pixel + WooCommerce + AJAX = Confusion
- PHP cookie not set within AJAX call
- WordPress Ajax send response on every iteration of a loop
- Running js in html code with same content
- Trigger a JavaScript function based on the data fetched from Woo commerce hook
- How to get current_user_id from wordpress in node js?
- Remove Woocommerce product from cart with ajax/fetch
- WooCommerce Modal Fly cart on add to cart – With AJAX
- AJAX call not initializing for non-admins in WordPress
- How to submit a button automatically after every scheduled hours?