A simple shopping cart using shortcodes.
Be sure your permalinks in WordPress settings supports slug urls e.g. your-domain.tld/slug. Once you have proper permalink setting, Create a page with slug /cart. Then edit the cart page and add [easy_cart /] and [empty_cart /] shortcodes.
Create add to cart buttons using [add_to_cart /] shortcodes on other posts or pages of your WordPress site.
Use the following attributes to define your add_to_cart products:
Here is a example usage of add_to_cart shortcode using all the attributes. Be sure to use single quotes:
[add_to_cart itemid=’your-item-id’ product_name=’Your product name’ product_desc=’description of your product.’ product_qty=1 price=1.00 /]
You can have as many add_to_cart shortcodes as you like, in posts and pages.
Shopping cart allows you to store items and calculate total but doesn’t allow you to checkout. At least not yet as of version 1.2.
- Unzip the plugin archive into plugins directory
- Login to WordPress admin dashboard
- Mouse over plugins on left dashboard menu and click installed plugins
- Click Activiate under “Easy Cart”
- Click Permalinks under settings and select postname or custom configure to allow for page slug in URL
- Create a page with slug “cart” in WordPress Admin
- Edit cart page and add shortcode [easy_cart /] and [empty_cart /]
- On other posts or pages add [add_to_cart /] shortcodes
There is no checkout?
sorry, not at the moment. Easy Cart is GPLv2 and the code is self explanitory.
Why is there a JSON error notification when I add [easy_cart /] shortcode on cart page?
You can ignore JSON error. When testing your add to cart button be sure to close the browser window entirely and open a new browser window. This will create a new session. You can also click on clear cart link. When testing your add to cart buttons also remember to monitor easy-cart cookie by pressing [shift] + [F9] on Firefox browser.
What about templates?
Use standard WordPress templates. You can create a wordpress page template for the cart display e.g “pagetemplate-cart.php”. Even the cart uses basic html table tags to display items and the item list table may be stylized to your desire.
This site uses “easy-cart” cookie to allow this site to temporarily store and display your item selections. The sites database auto garbage collects and deletes your selection after sixty minutes.
How can I create my own checkout?
In a pagetemplate-cart.php file in your wordpress you may do as you wish with the total amount and the post requests. Use the results and pass to a checkout slug, pagetemplate-checkout.php. Have fun!
There are no reviews for this plugin.
Contributors & Developers
“Easy Cart” is open source software. The following people have contributed to this plugin.Contributors
- Registered shortcodes as block patterns
- Attributes itemid, product_name, product_desc required single quotes
- Added output buffer to support shortcode content appearance where shortcode is placed using editor.
- Add to cart buttons support full site url. Support for easy cart usage in subfolder wordpress installations.
- List items and display total. Use shortcode to create add to cart buttons and display cart