WooCommerce - excelling eCommerce
Add to Cart Missing for Product Variations (40 posts)

  1. ouverz
    Posted 1 year ago #

    I finally got this to work for me, please find my re-edited code for the functions.php file (iv'e had an incorrect reference name -'add-to-cart' instead of 'wc-add-to-cart'):
    added the code below to functions.php file of my theme

    function register_woo_radio_button_scripts () {
    wp_dequeue_script('wc- add-to-cart-variation');
    wp_register_script( 'wc-add-to-cart-variation', plugins_url( get_stylesheet_directory_uri().'woocommerce/assests/js/frontend/add-to-cart-variation.min.js', __FILE__ ), array( 'jquery'), false, true );
    add_action( 'wp_enqueue_script', 'register_woo_radio_button_scripts' );

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    2. Next would be to add the line in css: .single_variation_wrap{display:block !important;}

  2. ManusH
    Posted 1 year ago #

    I think something has changed for the "VAriations" in the latest versions of WooCommerce.

    Btw; the latest version of WooCommerce is now: 2.0.19

    I was trying a setup in a test server for a few weeks time with an older version: 2.0.14
    Everything was fine, so I decide to setup the site in its dedicated server with new/updated versions,
    but now the Product with variations displays wrong. The price is not changing after selecting the variation!

    I think there are some changes in the latest updates that effect the variations :(

  3. anmaree.annarbortees
    Posted 1 year ago #

    ouverz: I used your solution and the add to cart finally showed up after hours of searching and trying different solutions. AWESOME!

    The only problem now is that when I click add to cart after selecting my product options, an error pops up saying Please choose product options even though the product options are selected.

    any thoughts on this?

  4. xazea11
    Posted 1 year ago #

    my bad... my store was working fine, until i try some ajax plugins. I have uninstaled and deleted them but now for variable product, add to cart and also tab function [product description, review] is not working.

    everything was fine before,

    my store: http://wowunik.com
    seems my JS is broken, isn't it?

    - i have tried to deactivated all plugins, deleted themes and installed it again
    - i have upgrade to wp 3.7 and also latest WC
    - i have also tried this: http://docs.woothemes.com/document/jquery-cookie-fails-to-load/
    - i also tried ouverz's method

    but still, i could not find my "add to cart" or even ajax search works :-(
    help me, my customers get confused

  5. ouverz
    Posted 1 year ago #

    anmaree.annarbortees - everything worked fine for me for a day or two and all of a sudden I started getting that same error ' please choose product options' even-though I clearly choose all the product options available.
    I did however notice that the error occurs only if I do not have a default option set in the backend of WooCommerce. For example, all my products have three options : 1. Weight (or) 2. Units 3. Cut type. So if the customer chooses 'Weight', 'Units' are automatically 0 and if he chooses 'Units' 'Weight' is automatically on 0.
    I have a fresh installation of WooCommerce, removed the function I added to the functions.php but this error is still occuring.
    Any ideas?
    my dev site is - http://www.best-foods-for-fat-burning.com/wordpress

  6. ouverz
    Posted 1 year ago #

    I just rechecked the issue discussed, I think the problem has to do with the value '0'. When I changed the value from the number zero to 'Zero' the product was successfully added to the cart.
    Odd , dont u think?
    What could cause this?

  7. okiekaren
    Posted 1 year ago #

    I'm totally lost reading all of these comments but I am having the same issue. I thought I'd be getting something relatively user friendly and wouldn't have to edit code. I use YIThemes (MayaShop) and I'm having the same issue with no add to cart button on any item with product variations. AND my drop-downs to choose the different variations are not working. I entered them in the 'advanced' tab after I set up the possible variations. I'm assuming these two issues are related. Perhaps if I could choose the options, then I might get an add to cart button. Somebody please help me in simple, English terms, for a person with no experience. (I fired my tech guy who was building me a site in OpenCart because after 3 years I still did not have a site.) Thanks.

  8. GKDantas
    Posted 1 year ago #

    Nothing working woith variations here also! And isnt related to WP or Theme. You can change the theme and the error still there. Looks that thye last WC update broke the code... any idea to fix that??

  9. xazea11
    Posted 1 year ago #

    this method works for me.

    1. Try to deactivated all plugins, and activate one by one [woocommerce first] while checking the impact for your site... in my case, the following plugins broke WC:
    - zoom image
    - popup plugin
    - seo wordspinner
    if this method doesn't work, try number 2.

    2. try to use another theme,if this step does not help
    3. export your entire database [original wp database + woocommerce database] except wp_options and another plugin database. reinstal your blog from scratch and import that database.

    it takes time but this is the easiest and fastest way rather than trying to do methods out there... [which are so many] n doesn't work for me.

    for me, this method only takes 2 hours, now my web is running correctly.

  10. Attrox
    Posted 1 year ago #

    Finally resolve the same problem after hours of digging. The solution was not mine. Hope this helps.

    For some reason my theme needs to load the add-to-cart-variation.js

    I copied the file from woocommerce directory to the /js directory for the theme.

    And add the following to functions.php

    function mv_my_theme_scripts()
    wp_enqueue_script('add-to-cart-variation', get_template_directory_uri() . '/js/add-to-cart-variation.js',array('jquery'),'1.0',true);


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic