WooCommerce · Elementor

Ajax Add to Cart widget for Elementor

An add-to-cart control that updates without a full page reload, with a notice you can style.

Open live demo

Get King Addons

This page describes the PHP/JS for this widget — not a renamed stub. Install the free plugin from WordPress.org.

Get King Addons

What it actually does

An add-to-cart control that updates without a full page reload, with a notice you can style.

Ajax Add to Cart Widget (Free).

render() writes HTML data attributes: data-product-id, data-quantity, data-success-text.

Output depends on WooCommerce objects (products, cart, or account). Empty without WooCommerce data.

The script talks to WooCommerce front-end events or add-to-cart URLs.

How to add it in Elementor

  1. Install King Addons. Install Elementor and King Addons. Get King Addons from WordPress.org.
  2. Edit with Elementor. Open a page and click Edit with Elementor.
  3. Insert the widget. Search the panel for “Ajax Add to Cart”. Typing “king” lists every King Addons widget.
  4. Set inspector controls from this widget’s PHP. Configure “Use Current Product (Single)”, “Product ID (fallback)”, “Quantity”, “Button Text”. Style and Content tabs are listed on this page.
  5. Preview the published page. Ajax Add to Cart Widget (Free).

When to use it

Tip: After King Addons is active, type king in the Elementor search box to list every widget, including Ajax Add to Cart.

Inspector controls from this widget’s PHP

ControlWhat the code does
Settings — Use Current Product (Single)On product pages, automatically use the current product.
Settings — Product ID (fallback)Used when not on a single product or when current product is unavailable.
Settings — QuantityNumeric value used in this widget’s render/JS (default 1, min 1, max 20).
Settings — Button TextPrinted in the widget HTML from render().
Settings — Success MessagePrinted in the widget HTML from render().
Button — AlignmentWrites CSS `justify-content` onto the widget’s front-end markup. Options: Left; Center; Right.
Button — TypographyElementor typography group: family, size, weight, transform, style, decoration, line-height, letter-spacing. Selector: `{{WRAPPER}} .king-addons-ajax-atc__button`.
Button — Text ColorWrites CSS `color` onto the widget’s front-end markup.
Button — BackgroundWrites CSS `background-color` onto the widget’s front-end markup.
Button — Hover Text ColorWrites CSS (button, color) onto the widget’s front-end markup.
Button — Hover BackgroundWrites CSS (button, background-color) onto the widget’s front-end markup.
Button — BorderElementor border group: type, width, color, and radius when the group includes it. Selector: `{{WRAPPER}} .king-addons-ajax-atc__button`.
Button — Border RadiusWrites CSS `border-radius` onto the widget’s front-end markup. (min 0, max 50).
Notice — TypographyElementor typography group: family, size, weight, transform, style, decoration, line-height, letter-spacing. Selector: `{{WRAPPER}} .king-addons-ajax-atc__notice`.
Notice — Text ColorWrites CSS `color` onto the widget’s front-end markup.

Content and Style tabs from this widget’s PHP, including repeater fields and group controls (typography, background, border, shadow). Elementor’s Advanced tab is core Elementor and is not listed here.

FAQ

Why doesn’t Ajax Add to Cart work in the Elementor preview?

AJAX handlers run on the published page. Preview the front end (or a Theme Builder preview of a real post) to test submit/filter requests.

Does Ajax Add to Cart require WooCommerce?

Yes. Install WooCommerce and add products (or complete a cart) before this widget has anything to show.

Do I need Elementor Pro?

No. King Addons runs on free Elementor. Some King Addons options (for example template-in-accordion, extra popup conditions, parts of the template catalog) need King Addons Pro — not Elementor Pro.

Related woocommerce widgets

Get King Addons

One free plugin. 80+ Elementor widgets, 650+ templates, and 4,000+ sections. Search for Ajax Add to Cart after you activate it.

Get King Addons