• I just noticed some odd behavior with the latest WC update. On the category page, when I hit the Select Options button on a variable product, instead of going to the product page, it just adds the variable product to the cart. What’s really strange is when I hover over the button I can see it’s linking to the product page. Yet it’s still just putting the product in the cart and staying on the catalog page.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Stuart Duff – a11n

    (@stuartduff)

    Automattic Happiness Engineer

    Hi @nhalauxehoi,

    Have you cross tested on our site by disabling all plugins aside from WooCommerce long with changing theme to a theme like Twenty Sixteen.

    On my test sites the Select Options button on product archives are redirecting to the single product page and not adding the product directly to cart with WooCommerce v2.6.6 installed.

    Thread Starter Hung PD

    (@nhalauxehoi)

    Hi @stuartduff,

    Here’s what I found digging around in the theme files…

    wp-content\themes\dione\woocommerce\add-to-cart.php:

    global $product;
    
    $class = 'button product_type_simple add_to_cart_button ajax_add_to_cart add-to-cart-button btn btn-border-black';
    
    echo '<div class="product-button">';
    echo apply_filters( 'woocommerce_loop_add_to_cart_link',
    	sprintf( '<a rel="nofollow" href="%s" data-quantity="%s" data-product_id="%s" data-product_sku="%s" class="%s">%s</a>',
    		esc_url( $product->add_to_cart_url() ),
    		esc_attr( isset( $quantity ) ? $quantity : 1 ),
    		esc_attr( $product->id ),
    		esc_attr( $product->get_sku() ),
    		esc_attr( isset( $class ) ? $class : 'btn btn-border-black' ),
    		esc_html( $product->add_to_cart_text() )
    	),
    	$product );
    
    echo '<a href="' . get_the_permalink() . '" class="product-review btn btn-border-black">' . esc_html( 'view item', 'tm-dione' ) . '<span class="pe-7s-search"></span></a>';
    echo '</div>';
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Variable Products Added to Cart when I Click Select Options Button’ is closed to new replies.