Apparently I was missing the time()
attribute.
So when adding this to the expire option in the setCookie function, the cookie is being set.
Code:
setcookie('user-zipcode', $zipcode, time() + MONTH_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
setcookie('delivery-today', $cookieVal, time() + DAY_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
Related Posts:
- wp_set_auth_cookie() doesn’t work in Ajax call
- WordPress Ajax Login without page reload
- Woocommerce Ajax Add cart not working
- Why a strange discrepency between get_current_user_id() when using AJAX versus output of document.cookie?
- SSO autologin WordPress + Ajax
- How can I set cookies on both secure and non-secure origins at the same time?
- Ajax login fails: script sets cookies, but is_user_logged_in() returns false
- Caching for logged in user and Ajax update
- Ajax in a settings page (update_option is undefined)
- gettext does not translate when called in ajax
- Execute one AJAX request after another AJAX request finished
- Ajax and autocomplete
- admin-ajax.php vs Custom Page Template for Ajax Requests
- Load tinyMCE / wp_editor() via AJAX [duplicate]
- Saving (Updating) Post / Page Edits With AJAX
- How to correctly load wordpress in a non WP script for AJAX request
- Why is admin ajax reloading my page
- Plupload in metabox – AJAX action not working in Class
- Admin Ajax always return 0 on form submit
- CPU usage: AJAX and Heartbeat API on admin pages
- Confused on AJAX submit form through page template
- Ajax call in wordpress not working for subscriber user in front site
- add_action(‘wp_ajax_[action name]’, myfunction) problem
- Can part of my WordPress website be headless?
- Nonces, AJAX, script variables & security in WordPress
- Extending wp JavaScript base class to make a post request to a custom REST endpoint
- Why would admin-ajax.php redirect to the home page for logged out users?
- wp_localize_script escaping my url – fix or alternative
- Insert wp_editor on front-end with AJAX?
- Admin Ajax and HTML5 Formdata
- Buddypress: Load Ajax Without Template Pack [closed]
- Implementing an AJAX POST API call in wordpress
- I have to post data by AJAX in wordpress to another Website
- Placement of add_action() for ajax callback?
- WordPress ajax problem need wordpress expert?
- Ajax WordPress Login needs to be stayed in current page Url without redirecting
- wp_ajax function did not call
- wp_handle_upload returns empty error array
- Loading comments in ajax – comment-reply function missing $args
- Woocommerce update product price via AJAX
- How do I query posts by a sub value with the API?
- Popup or admin/update notice on post/page edit screen without page refresh
- Single page site + pushState?
- Interim-Login form on frontend
- Ajax call does not work for this simple code
- WordPress ajax call returns a zero though die()
- Save value from Javascript object to WP user
- wp_update_post onclick button using ajax
- add Additional class to woocommerce cart-contents link
- Localize script not working
- wp_ajax declaration confusing for Front end
- Delete ACF repeater field row on Front End
- No errors in the console but Ajax call doesn’t seem to be working
- Preprocess submitted data
- Update status, meta while inside a post using AJAX button
- WP_query offset seems to be counting draft post – AJAX load more
- adding ajax load more to display images from meta box
- Can’t load search results with ajax
- wp_ajax is not calling the action
- Deny dashboard access breaks ajax requests
- Run javascript upon successfully set featured image
- update_option in WordPress AJAX
- ajax in admin menu
- admin-ajax.php not loading anymore
- How do you use do_shortcode via AJAX call?
- Auto-suggest to display meta-data, but not to include it upon click
- Loading pages via Ajax and displaying titles
- Ajax Favorite from foreach (how to specify which result result is processed)
- change wordpress pagination url after doing the request
- WordPress responds to the ajax request with readyState 1, 2, 3 before responding with 4
- Filter images from media library by guid meta field
- Counting Posts with multiple taxonomy and terms condition using MySQL and AJAX
- How to send automatic response after form submission without plugin
- How to return a record from a custom table by sending an AJAX request
- 400 Bad Request getting on AJAX Call
- admin-ajax.php 403 errors – no caching, permissions are fine
- React to AJAX adding to the page
- gform_after_submission does not work on ajax enabled form
- How to add Ajax to this Pagination i made?
- Adding user using admin ajax by a user with custom role
- How can I run two AJAX requests simultaneously in WordPress?
- Issue developing an AJAX form with WordPress
- Calendar month navigation in Ajax only working once
- 403 error for ajax POST request
- How modify comments metabox on post edit screen in WordPress?
- my ajax action doesn’t get hit
- Can Ajax Action [add_action(‘wp_ajax_{action_name}’, ‘{action_name}’] be hooked into wp hook
- Strange AJAX problem (SOMETIMES works in Chrome/FF, ALWAYS works in Midori)
- How to check for dependencies for a specific page and enqueue them
- Get Page Type (Category/Tag) Using AJAX
- Loads posts of different year via AJAX call
- Data from ajax not updating post meta
- Ajax object comes back empty
- Ajax Slideshow in Post
- WordPress & Ajax
- wordpress ajax always return 0
- WordPress wp_localize_script nonce and ajax URL
- $wpdb Ajax not redirecting to main page
- how reduce fetch/XHR response time
- Custom WP rest api endpoint only working on non https?