How does this work?
-
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/
-
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.
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/
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.
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?
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.
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>Does this work with woocommerce 2.0?
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…
It seems
wc_add_to_cart_paramsis the source of the problem.. i assume it returns false, so wc_add_to_cart_params is undefined?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,
EnigmaHi Danz,
I have another ticket with you written that you solved this issue with older version. so marking this ticket resolved.
The topic ‘How does this work?’ is closed to new replies.