Add to Cart Anywhere + Quantity Stepper
Adds a shortcode that renders WooCommerce add-to-cart forms anywhere, including variation forms and plus/minus quantity controls.
by Your Name · github.com/reaganm02/add-to-cart-anywhere · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/reaganm02/add-to-cart-anywhere/archive/refs/heads/main.zipReadme
Add To Cart Anywhere
Add To Cart Anywhere provides a shortcode that renders WooCommerce add-to-cart forms outside the single product page. It supports variable products using WooCommerce's native variation form template and adds plus/minus buttons around the quantity input.
Features
- Render add-to-cart forms anywhere via shortcode.
- Variable product support using the same template as the product page.
- Quantity stepper with min/max/step support.
Usage
Shortcode:
[atca_product id="123"]
Replace 123 with the WooCommerce product ID.
Installation (Composer Required)
This plugin uses Composer for autoloading. Install Composer and install dependencies before activating the plugin.
-
Install Composer:
- Windows: download and run the Composer-Setup executable from getcomposer.org.
- macOS/Linux: follow the installer on getcomposer.org.
-
Install dependencies without dev packages (recommended for production):
composer install --no-dev --optimize-autoloader --classmap-authoritative
This installs only production dependencies and generates an optimized class map so classes load correctly.
Internals
- Main shortcode handler class:
AddToCartAnywhereShortcode(previouslyProductFrontend). - Template rendering uses WooCommerce templates:
single-product/add-to-cart/variable.phpsingle-product/add-to-cart/simple.php
Notes
- This plugin relies on WooCommerce being active.
- Quantity stepper behavior is powered by
assets/js/plus-and-minus.js.