Title: How does this work?
Last modified: August 22, 2016

---

# How does this work?

 *  Resolved [M.Danz](https://wordpress.org/support/users/mdanz-1/)
 * (@mdanz-1)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/how-does-this-work-23/)
 * I’ve enabled the plugin and when on the single-product.php page, when i click
   the add to cart button the page still refreshes?
 * [https://wordpress.org/plugins/woocommerce-ajax-add-to-cart-for-variable-products/](https://wordpress.org/plugins/woocommerce-ajax-add-to-cart-for-variable-products/)

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Plugin Author [Rishi Mehta](https://wordpress.org/support/users/rcreators/)
 * (@rcreators)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/how-does-this-work-23/#post-5836229)
 * Hi Danz,
 * There are 4 type of products in woo-commerce. Simple, Variable, Group and Virtual.
 * Now if you have simple product and want to add through ajax, that is already 
   in woo-commerce setting.
 * This plugin is adding Ajax functionality for Variable products only as that is
   not inside woo-commerce. To get that functionality working, you only need to 
   activate plugin.
 * If its not working, it means your template have missing woo-commerce default 
   classes in html.
 * It will be good if you can provide testing url, so i can look into it and give
   you exact solution.
 *  Thread Starter [M.Danz](https://wordpress.org/support/users/mdanz-1/)
 * (@mdanz-1)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/how-does-this-work-23/#post-5836230)
 * I’m not following. For example, if i’m on a single product page with variations
   and i click the add to cart button.. what is the plugin intended to do? I thought
   that if i press add to cart the page won’t refresh & the cart will be updated
   via ajax?
 * Here is a link with variations..
 * [https://www.plantsandtreesonline.co.uk/product/shiplap/shiplap-timber/](https://www.plantsandtreesonline.co.uk/product/shiplap/shiplap-timber/)
 *  Plugin Author [Rishi Mehta](https://wordpress.org/support/users/rcreators/)
 * (@rcreators)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/how-does-this-work-23/#post-5836231)
 * Hi Danz,
 * Thanks for the quick Response. I checked your link. Things which are come to 
   my mind first.
 * 1) you need to install and activate plugin on site, so i can test it from here
   and give you respond based on that.
 * 2) You are missing one product type variable class in your template. I have attached
   Screen shot where you need to put this class “product-type-variable” – Without
   this class, js will not work.
 * > [View post on imgur.com](https://imgur.com/vWMEn2H)
 *  Thread Starter [M.Danz](https://wordpress.org/support/users/mdanz-1/)
 * (@mdanz-1)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/how-does-this-work-23/#post-5836256)
 * I’ve activated the plugin and added the product-type-variable and when pressing
   add to cart the page still refreshes? How do i resolve this?
 *  Plugin Author [Rishi Mehta](https://wordpress.org/support/users/rcreators/)
 * (@rcreators)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/how-does-this-work-23/#post-5836257)
 * Hi,
 * Can you disable this plugin – Woocommerce better product addons master
 * I guess this plugin is also creating issue with amount refreshing in variable
   page. if you check, variable price is not updating on page. It remains same all
   the time while it actually different.
 * Let me know after you disable that plugin, so i can cross check, whether it solved
   the issue or anything more i need to look into.
 *  Thread Starter [M.Danz](https://wordpress.org/support/users/mdanz-1/)
 * (@mdanz-1)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/how-does-this-work-23/#post-5836258)
 * I disabled the plugin and still the page refreshes when pressing add to cart.
   The variable not changing is due to price rounding up function in functions.php
 *     ```
       add_filter( 'woocommerce_get_price_excluding_tax', 'round_price_product', 10, 1 );
       add_filter( 'woocommerce_get_price_including_tax', 'round_price_product', 10, 1 );
       add_filter( 'woocommerce_tax_round', 'round_price_product', 10, 1);
       add_filter( 'woocommerce_get_price', 'round_price_product', 10, 1);
   
       function round_price_product( $price ){
           // Return rounded price
   
           if ($price % 10 > 5) {
               $newPrice = floor($price / 10) * 10 + 9.95;
           } elseif ($price % 10 <= 5) {
               $newPrice = floor($price / 10) * 10 + 5.95;
           }
   
           return $newPrice;
       }
       ```
   
 * I need this function for website. How does the plugin change the add to cart 
   button?
 * `<button class="single_add_to_cart_button buy_button fl_left button alt" type
   ="submit">Add to cart</button>`
 *  Thread Starter [M.Danz](https://wordpress.org/support/users/mdanz-1/)
 * (@mdanz-1)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/how-does-this-work-23/#post-5836270)
 * Does this work with woocommerce 2.0?
 *  Thread Starter [M.Danz](https://wordpress.org/support/users/mdanz-1/)
 * (@mdanz-1)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/how-does-this-work-23/#post-5836271)
 * I had some sort of response when removing this
 *     ```
       if ( typeof wc_add_to_cart_params === 'undefined' )
   
       		return false;
       ```
   
 * I disabled plugins that any plugins that could cause the error. Is this a theme
   problem? I’m using woocommerce 2.0, could that be the problem? Are there any 
   functions your using that aren’t compatible with woocommerce 2.0? Is there a 
   workaround, as this is quite urgent…
 *  Thread Starter [M.Danz](https://wordpress.org/support/users/mdanz-1/)
 * (@mdanz-1)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/how-does-this-work-23/#post-5836272)
 * It seems
 * `wc_add_to_cart_params` is the source of the problem.. i assume it returns false,
   so wc_add_to_cart_params is undefined?
 *  [enigma82](https://wordpress.org/support/users/enigma82/)
 * (@enigma82)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/how-does-this-work-23/#post-5836320)
 * Rcreator,
    In one of the posts I saw that you have a couple of unused wp-client
   licenses. I’m looking to use wp-client plugin for my portal and was wondering
   if you could add my website to that list. My website url is writigo.com.
 * Please let me know.
 * Thanks,
    Enigma
 *  Plugin Author [Rishi Mehta](https://wordpress.org/support/users/rcreators/)
 * (@rcreators)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/how-does-this-work-23/#post-5836323)
 * Hi Danz,
 * I have another ticket with you written that you solved this issue with older 
   version. so marking this ticket resolved.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘How does this work?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/woocommerce-ajax-add-to-cart-for-
   variable-products_fbfbfa.svg)
 * [Woocommerce Ajax add to cart for variable products](https://wordpress.org/plugins/woocommerce-ajax-add-to-cart-for-variable-products/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-ajax-add-to-cart-for-variable-products/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-ajax-add-to-cart-for-variable-products/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-ajax-add-to-cart-for-variable-products/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-ajax-add-to-cart-for-variable-products/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-ajax-add-to-cart-for-variable-products/reviews/)

 * 11 replies
 * 3 participants
 * Last reply from: [Rishi Mehta](https://wordpress.org/support/users/rcreators/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/how-does-this-work-23/#post-5836323)
 * Status: resolved