Answer the question
In order to leave comments, you need to log in
Why are there different cookie sets in wordpress on the page and in ajax?
In wordpress, I wrote cookies in ajax, after which they are correctly displayed in ajax, including after refreshing the page:
add_action('wp_ajax_addtocart', 'addtocart_callback');
add_action('wp_ajax_nopriv_addtocart', 'addtocart_callback');
function addtocart_callback() {
var_dump($_COOKIE);
...
setcookie('cartQuantity', $cartQuantity, time() + (86400 * 30));
...
wp_die();
}
var_dump($_COOKIE);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question