How to Enable Ajax Add To Cart Button for Sample Products?

You can let customers add a sample to the cart without a full page reload by enabling Ajax add to cart.

Turn on Enable Ajax Add to Cart in the Ajax Add To Cart section. You can also show a success dialog after the sample is added, and customize the dialog button text.

How to enable Ajax add to cart

  1. Go to Dotstore Plugins > Product Sample and open the Manage Sample tab and open the Ajax Add To Cart section.
  2. Turn on Enable Ajax Add to Cart.
  3. Optionally turn on Enable Ajax Dialog if you want a success dialog after the sample is added.
  4. If the dialog is enabled, you can change the Button Label for that dialog. The default value is Done!
  5. Click Save Changes.

Ajax add to cart settings

The Ajax Add To Cart section includes these options:

  • Enable Ajax Add to Cart — Turn Ajax add to cart on or off.
  • Enable Ajax Dialog — Turn the success dialog on or off.
  • Button Label — Set the text on the success dialog button. The default is Done!
Ajax Add To Cart section with Enable Ajax Add to Cart, Enable Ajax Dialog, and Button Label
Figure - Ajax add to cart settings
Storefront product page adding a sample to the cart with Ajax and a success dialog
Figure - A sample product using Ajax add to cart

Pro Tips

  • Enable Enable Ajax Dialog if you want clear confirmation that the sample was added.
  • Keep the dialog Button Label short, such as the default Done!
  • After you save, test the sample button on a product page to confirm the cart updates without a full reload.

Common Use Cases

Here are some popular ways to use Ajax add to cart:

1. Let customers add a sample without leaving the page

Turn on Enable Ajax Add to Cart so the product page does not fully reload.

2. Show a success dialog

Turn on Enable Ajax Dialog and customize the Button Label if you want a confirmation message after the sample is added.

FAQs

1. Where do I enable Ajax add to cart for samples?

Go to Dotstore Plugins > Product Sample and open the Manage Sample tab, open Ajax Add To Cart, and turn on Enable Ajax Add to Cart.

2. What does Enable Ajax Dialog do?

It shows a success dialog after a sample is added to the cart. You can change the dialog’s Button Label. The default is Done!

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.