WordPress.org

Ready to get started?Download WordPress

Forums

Woocommerce Add to Cart Missing for Product Variations (1 post)

  1. daniellemacleod
    Member
    Posted 6 months ago #

    I am hoping someone lovely may be able to help me.
    Ive looked through previous resolved posts on this issue and tried all fixes but none have worked for our website.

    We have product variations for our products (those which are short dated food items are at a reduced price to long dated) but although the selection appears correctly, the "Add to Cart" button has not appeared.
    This is on FIREFOX and SAFARI ONLY.
    All works OK on Internet Explorer.

    This seems to have happened since an update (although im not sure which) as it was previously working with no problems on all browsers.
    We are running the Artificer theme on WP 3.8.

    Currently I have tried the following:
    - Amended the add-to-cart-variation.min.js file code:

    if ( !all_variations )
    all_variations = window["product_variations_" + product_id];

    - Copied the add-to-cart-variation.min.js file to match the add-to-cart-variation.js file.
    - deactivated all plugins one by one
    - changed the name of the files jquery.cookie.js and jquery.cookie.min.js to jquery-cookie.js and jquery-cookie.min.js and added code to Functions.php file:

    add_action( 'wp_enqueue_scripts', 'custom_frontend_scripts' );

    function custom_frontend_scripts() {

    global $post, $woocommerce;

    $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
    wp_deregister_script( 'jquery-cookie' );
    wp_register_script( 'jquery-cookie', $woocommerce->plugin_url() . '/assets/js/jquery-cookie/jquery_cookie' . $suffix . '.js', array( 'jquery' ), '1.3.1', true );

    - Added this code to functions.php:

    add_action( 'wp_enqueue_script', 'register_woo_radio_button_scripts' );

    - Added this code to functions.php:

    function register_woo_radio_button_scripts () {

    wp_deregister_script('add-to-cart-variation');

    wp_dequeue_script('add-to-cart-variation');

    wp_register_script( '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 );

    wp_enqueue_script('add-to-cart-variation');

    }

    - Tried another Theme (Still did not work)
    Nothing has worked and Im not stumped as to how to fix this.
    Please can someone help? :(

Reply

You must log in to post.

About this Topic

  • RSS feed for this topic
  • Started 6 months ago by daniellemacleod
  • This topic is not resolved
  • WordPress version: 3.8