If you have enabled the CORS policy headers then you can directly add a product via link given below;
Site-url.com/?add-to-cart=PRO-ID&variation_id=ATTR-ID&quantity=1&attribute_YOUR-ATTR-NAME=ATTR-VALUE
Trigger this url for an ajax / windows location
on an action in your javascript.
Related Posts:
- WooCommerce: Translation lost on AJAX call in Checkout page [closed]
- Woocommerce Ajax Add cart not working
- Woocommerce update product price via AJAX
- Variable Products Being Added to Cart with AJAX on Shop and Category Pages
- add Additional class to woocommerce cart-contents link
- Display SOLDOUT text in Dropdowns of Variable Product in WooCommerce [closed]
- Facebook Pixel + WooCommerce + AJAX = Confusion
- Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
- Show spinner GIF during an $http request in AngularJS?
- ASP.NET MVC controller actions that return JSON or partial html
- How to check if I am in admin-ajax.php?
- Ajax in a settings page (update_option is undefined)
- admin-ajax.php vs Custom Page Template for Ajax Requests
- Saving (Updating) Post / Page Edits With AJAX
- Is there a hook that fires before an ajax call?
- AJAX request from Chrome Extension to WordPress Website
- How to correctly load wordpress in a non WP script for AJAX request
- Minimal WordPress load for only `get_option` to work (because ajax…)
- How to save Clicks of a download link button while it doesn’t matter if we refresh the page or again login/logout
- Why is admin ajax reloading my page
- Admin Ajax always return 0 on form submit
- Why this plugin doesn’t work with media upload page?
- 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
- Solve cors problem using rest api or ajax
- Can part of my WordPress website be headless?
- Why does WordPress Heartbeat login not refresh the nonces?
- Why would admin-ajax.php redirect to the home page for logged out users?
- Insert wp_editor on front-end with AJAX?
- Admin Ajax and HTML5 Formdata
- Buddypress: Load Ajax Without Template Pack [closed]
- How to make custom total price reactive in navigation
- 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?
- Identical wp_rest nonce returned from rest_api
- wp_handle_upload returns empty error array
- Loading comments in ajax – comment-reply function missing $args
- How do I query posts by a sub value with the API?
- Enqueue script in plugin is not working
- Interim-Login form on frontend
- Ajax call does not work for this simple code
- Save value from Javascript object to WP user
- Ajax insert or update data
- Check ajax triggered from front-end or from dashboard
- Localize script not working
- Add Ajax to rating button
- Why, if a function accepts arguments, it fails on ajax calls?
- Preprocess submitted data
- Update status, meta while inside a post using AJAX button
- How to disable drag-and-drop upload function in Media Library?
- WooCommerce event works in jQuery but not in JavaScript
- WP_query offset seems to be counting draft post – AJAX load more
- Can’t retrieve any content from Ajax-loaded page
- 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
- admin-ajax.php not loading anymore
- How to load dynamic option with ajax
- How do you use do_shortcode via AJAX call?
- Auto-suggest to display meta-data, but not to include it upon click
- Register Template
- 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
- Refresh Gutenberg with JS for it show updated post
- WooCommerce variable product can not add to cart using ajax after updating latest version of WooCommerce
- How to Object.freeze wp_localize_script
- How to return a record from a custom table by sending an AJAX request
- WordPress New Post via ajax call
- React to AJAX adding to the page
- gform_after_submission does not work on ajax enabled form
- Change WooCommerce currency programmatically on AJAX request
- Update / refresh mini cart, after custom AJAX add_to_cart event
- 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?
- Ajax call not working anymore
- Ajax global variable is not getting saved (returns null)
- WP admin ajax Pagination issue
- 403 error for ajax POST request
- Why function called by admin-ajax executes synchronously?
- my ajax action doesn’t get hit
- Can Ajax Action [add_action(‘wp_ajax_{action_name}’, ‘{action_name}’] be hooked into wp hook
- Get Page Type (Category/Tag) Using AJAX
- Ajax Form data is not posted back to the get_results()
- Loads posts of different year via AJAX call
- Remove dashboard access but allow ajax file upload
- fail to load /wp-admin/admin-ajax.php locally
- BBPress AJAX problem
- Ajax object comes back empty
- WordPress & Ajax
- $wpdb Ajax not redirecting to main page
- how reduce fetch/XHR response time
- wordpress ajax bad request 400
- Custom WP rest api endpoint only working on non https?