• Resolved earth_human

    (@earth_human)


    Store/shop page “available options” buttons under the products don’t scroll to variation table. They just bring you to the top of the product page where you must then click “available options” again, or scroll down to find the variation table on your own. What’s the easiest way to “fix” this problem?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author WPXtension

    (@wpxteam)

    @earth_human

    Thanks for getting back to us. Sorry for our late response, we were on a vacation.

    Will you please share an exact product link to check?

    Hope to hear from you soon!

    Thread Starter earth_human

    (@earth_human)

    Okay the URL is shown in this image in the address bar near the top. You can test it yourself.

    Problem is that the store/shop page “available options” buttons under the products don’t scroll to variation table. They just bring you to the top of the product page where you must then click “available options” again, or scroll down to find the variation table on your own. What’s the easiest way to “fix” this problem?

    Plugin Author WPXtension

    (@wpxteam)

    @earth_human

    Thanks for your clarification. Unfortunately, we have no feature for the archive/shop page.

    Our plugin just works on a single product page. It is beyond our scope. However, you can try the following snippet to achieve what you described above:

    add_filter('woocommerce_loop_add_to_cart_link', function( $html, $product, $args ){
    	if( $product->is_type( 'variable' ) ){
    		return sprintf(
    			'<a href="%s" data-quantity="%s" class="%s" %s>%s</a>',
    			esc_url( $product->add_to_cart_url().'#variant-table' ),
    			esc_attr( isset( $args['quantity'] ) ? $args['quantity'] : 1 ),
    			esc_attr( isset( $args['class'] ) ? $args['class'] : 'button' ),
    			isset( $args['attributes'] ) ? wc_implode_html_attributes( $args['attributes'] ) : '',
    			esc_html( $product->add_to_cart_text() )
    		);
    	}
    	else{
    		return $html;
    	}
    }, 10, 3);

    Thanks

    Thread Starter earth_human

    (@earth_human)

    Seems to work. Thank you!

    Plugin Author WPXtension

    (@wpxteam)

    @earth_human

    Glad to know it worked. If you find the plugin and my support helpful, please don’t forget to share your beautiful words here.

    It will inspire us a lot.

    Thanks in advance for your beautiful words.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Store page “available options” buttons don’t scroll to variation table’ is closed to new replies.