Ajaxified Cart
Ajaxified Cart
Description
WooCommerce core does not provide AJAX add-to-cart on the single product page or for variable products listed on archive pages (it redirects to the single view). This plugin adds an unobtrusive AJAX workflow for:
- Simple products (single product page button becomes AJAX)
- Variable products on archive & block-based Product Collection (opens an accessible modal to choose attributes, then adds via AJAX)
- Classic themes and modern block/FSE themes (2025 and later) with Product Collection blocks
Highlights:
* Works with WooCommerce fragments (mini-cart updates automatically)
* Accessible modal (focus trap, ESC to close, restore focus)
* Nonce-secured AJAX endpoints; sanitized and validated input
* Settings page to enable/disable variable product archive functionality
* Block theme compatibility (intercepts “Select options” buttons) with slug/product_id fallback
* Performance-minded (loads minified bundles built via Webpack; falls back to source if missing)
* Translations auto-loaded from WordPress.org (no manual POT/PO generation required)
Privacy: This plugin does not send any data to external services. It only uses WooCommerce cart/session APIs.
Development
Build commands:
- Install dependencies:
npm install - Production build (minified + source maps):
npm run build - Watch during development:
npm run watch - Lint JS:
npm run lint
Translations: WordPress.org language packs auto-load this plugin’s strings. The former POT/PO/MO tooling and i18n loader file were removed (WP 4.6+). Do not add a load_plugin_textdomain() call; simply keep the Text Domain header accurate.
WooCommerce is a registered trademark of Automattic Inc. This plugin is not affiliated with or endorsed by Automattic/WooCommerce.
Installation
- Upload the
ajaxified-cart-woocommercefolder to/wp-content/plugins/. - Activate the plugin through the “Plugins” menu in WordPress.
- (Optional) Visit Settings > General > Ajaxified Cart to enable variable product archive AJAX.
- (Developers) Build assets if modifying JS:
npm install && npm run build.
Faq
Yes. Variable product “Select options” buttons in Product Collection blocks are intercepted, opening a modal for attributes.
Go to Settings > General > Ajaxified Cart and check “Enable ajaxified cart for variable products on archive page”.
Yes. Override or enqueue your own CSS after abwc-modal or copy the CSS file and adjust.
Typically no. Ensure the localized nonce is not stripped and that minification does not remove required data attributes.
Yes, it works on multi-site installations.
They are served automatically from WordPress.org language packs; no manual tools or bundled .mo files are needed.
Reviews
Compatibility issues
By uniqcode on February 2, 2021
It works. And it works great!
By alnimos on January 15, 2021
Works like a charm
By classikd on March 28, 2020
Exactly what I need
By kookool on March 21, 2020
Great plugin
By steloot on August 7, 2019
Awsome! this plugin rly save me
By reddevil46 on October 18, 2018
Exactly what in need
By younesben on August 27, 2018
Perfect
By Adam-Equinoxe on August 25, 2018
Очень нужный плагин.
By prudiki (prudikiru) on April 12, 2018
Fantastic!
By deralict on April 11, 2018
Changelog
2.0.2
- Fix: Prefixed bootstrap variable for URL to satisfy WPCS global prefix rule.
- Tweak: Shorter plugin header/tagline (<150 chars) for WordPress.org guidelines.
- Security: Refinement of variation attribute sanitization (removed phpcs ignore, explicit key/value cleanup).
- Cleanup: Removed unused POT tooling file and generator script; relies on WP.org language packs.
- Cleanup: Removed uninstall references/documentation.
2.0.1
- Security: Strengthened sanitization for quantity, variation data, product slug, and variation_id validation.
- Added Requires Plugins header for explicit WooCommerce dependency.
- Escaped output of hidden AJAX input via wp_kses.
- Removed legacy translation loader & uninstall cleanup code; simplified README.
2.0.0
- Build migration: moved from Grunt to Webpack (minified bundles + source fallback).
- Performance & code structure improvements.
- Compatibility updates: Tested up to WordPress 6.8.3 and recent WooCommerce versions.
- Block theme support: Product Collection block variable products open an AJAX modal.
- Security: Added nonce verification + full sanitization for all AJAX inputs.
- Accessibility: Focus trap, ESC close, refresh link, restored focus to triggering button, improved modal semantics.
- Internationalization: Auto-load via WordPress.org (removed manual textdomain loader & POT tooling).
- Styling: Introduced dedicated modal stylesheet (abwc-modal.css).
- Compliance: ABSPATH guards across files, WPCS docblock adjustments, sanitized settings.
- Fallback logic: Ensures dist minified JS used when available, source files otherwise.
1.0.0
- Initial release
1.0.1
- Code Refactor for performance
1.0.2
- Single Product page AJAX fix
1.0.3
- Cart Display fix
1.2.0
- Added admin settings page for enabling/disabling ajaxified cart for variable products on shop page.
- Now ajaxified cart is working for variable products on shop page.
- Notices fixed on product single page.
1.2.1
- Fatal error fix
1.2.2
- Simple products archive ajax add to cart when variable product archive ajax option is enabled issue fix.
- Fixed 500 error when trying to add more variation products to cart than stock holds.