1. Home
  2. Knowledge Base
  3. WooCommerce Product Table
  4. Product Table Shortcode Options
  5. Add to Cart buttons

Add to Cart buttons

WooCommerce Product Table comes with several options to control how Add to Cart buttons appear in the table. You can choose buttons or checkboxes, show or hide the quantity selector and whether or not to use AJAX add to cart.

Add to Cart button types

The cart_button option controls how the Add to Cart buttons are displayed in the product table. This option only applies when using the add-to-cart column in your table.

There are 3 options:

  • button – The default option. Displays the standard add to cart button for each product, or if the product cannot be purchased (out of stock, grouped product, etc), then a Read More or View Products link is displayed.
  • button_checkbox – Displays the same add to cart button with an additional checkbox next to the button which allows the customer to select multiple products in the table. To add them to their cart, they click the ‘Add Selected to Cart’ button above the table.
  • checkbox – Displays the checkbox on its own without the add to cart button.

Examples:

[product_table columns="name,price,add-to-cart" cart_button="button"]
[product_table columns="name,price,add-to-cart" cart_button="button_checkbox"]
[product_table columns="name,price,add-to-cart" cart_button="checkbox"]

Select quantity

By default, the Add to Cart buttons appear in the table without a quantity selector. You can set show_quantity to true to display a quantity box next to the “Add to Cart” button, or false to hide it.

Example: [product_table show_quantity="true"]

If the quantity selector isn’t working, please read our article about quantity selector problems.

AJAX add to cart

The plugin fully supports AJAX add to cart behaviour, including both for individual products and when adding several products at once. If you wish to disable AJAX functionality, set the ajax_cart option to false, for example: [product_table ajax_cart="false"]

Was this article helpful?

Related Articles