mp_buy_button not working

I upgraded my theme to MarketPress 3.x. Buy Now button no longer works. Clicking on it just takes me to the cart. Add to Cart works on list pages.

Here is my code for mp_product.php:

get_header();
st_before_content($columns='');

if ( have_posts() ) while ( have_posts() ) : the_post(); ?>

<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

<?php if (!is_page_template('onecolumn-page.php')) { ?>
<?php if (is_front_page() && !get_post_meta($post->ID, 'hidetitle', true)) { ?>

<h2 class="entry-title home-title"><?php the_title(); ?></h2>

<?php } elseif (!get_post_meta($post->ID, 'hidetitle', true)) { ?>

<h1 class="entry-title"><?php the_title(); ?></h1>

<?php } else {
echo '';
} ?>
<?php } ?>

<div class="entry-content">
<?php mp_product_image( false , 'list' ); ?>
<?php mp_product_price();
mp_product_description();

mp_buy_button( true , 'single' );

comments_template( '', true ); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'skeleton' ), 'after' => '</div>' ) ); ?>
<?php edit_post_link( __( 'Edit', 'skeleton' ), '<span class="edit-link">', '</span>' ); ?>
</div><!-- .entry-content -->
</div><!-- #post-## -->

<?php endwhile; // end of the loop.

st_after_content();
get_sidebar('publications');
get_footer();

This is a link to the page: http://staging.bccbooks.org/store/products/the-noblest-roman/

    Panos

    Hey dewdropmedia ,

    Not out of the box I'm afraid, but I can provide you with what I just tested and seems to be working

    First we need a custom function, which you can add in a mu-plugin or in your child theme's functions.php:

    function wpmudev_mp_buy_button_force_redirect( $product, $echo = true, $context = 'list', $selected_atts = array(), $no_single = false, $mp_buy_button = false ) {
    		$button = '';
    		if ( $product->get_meta( 'product_type' ) == 'external' && ( $url = $product->get_meta( 'external_url' ) ) ) {
    			$button = '<a class="mp_link-buynow" href="' . esc_url( $url ) . '">' . __( 'Buy Now &raquo;', 'mp' ) . '</a>';
    		} elseif ( ! mp_get_setting( 'disable_cart' ) ) {
    			$button = '<form id="mp-buy-product-' . $product->ID . '-form" class="mp_form mp_form-buy-product ' . ( $no_single ? 'mp_no_single' : '' ) . ' ' . ( $mp_buy_button ? 'mp_buy_button' : '' ) . '" method="post" data-ajax-url="' . mp_get_ajax_url( 'admin-ajax.php?action=mp_update_cart' ) . '" action="' . mp_cart_link( false, true ) . '">';
    
    			if ( ! $product->in_stock() ) {
    				$button .= '<span class="mp_no_stock">' . __( 'Out of Stock', 'mp' ) . '</span>';
    			} else {
    				$button .= '<input type="hidden" name="product_id" value="' . $product->ID . '">';
    				$disabled = '';
    				if( !$product->in_stock( 1, true ) ){
    					$disabled	  = 'disabled';
    				}
    				if ( $context == 'list' ) {
    					if ( $product->has_variations() ) {
    						$button .= '<a class="mp_button mp_link-buynow mp_button-has_variations" data-href="' . admin_url( 'admin-ajax.php?action=mp_product_get_variations_lightbox&product_id=' . $product->ID ) . '" href="' . $product->url( false ) . '">' . __( 'Choose Options', 'mp' ) . '</a>';
    					} else if ( mp_get_setting( 'list_button_type' ) == 'addcart' ) {
    						$button .= '<button ' . $disabled . ' class="mp_button mp_button-addcart" type="submit" name="addcart">' . __( 'Add To Cart', 'mp' ) . '</button>';
    					} else if ( mp_get_setting( 'list_button_type' ) == 'buynow' ) {
    						$button .= '<button ' . $disabled . ' class="mp_button mp_button-buynow" type="submit" name="buynow">' . __( 'Buy Now', 'mp' ) . '</button>';
    					}
    				} else {
    					$button .= $product->attribute_fields( false, $selected_atts );
    
    					$button .= '<button ' . $disabled . ' class="mp_button mp_button-buynow" type="submit" name="buynow">' . __( 'Buy Now', 'mp' ) . '</button>';
    				}
    			}
    
    			$button .= '</form><!-- end mp-buy-product-form -->';
    		}
    
    		$button = apply_filters( 'mp_buy_button_tag', $button, $product->ID, $context, $selected_atts, $no_single );
    
    		if ( $echo ) {
    			echo $button;
    		} else {
    			return $button;
    		}
    	}

    Then you can call it like this from your template file:

    //You need to have the $product_id, for eg:
    //$product_id = $post->ID;
    
    $product = new MP_Product( $product_id );
    
    echo MP_Short_Codes::get_instance()->shortcode_wrap( wpmudev_mp_buy_button_force_redirect( $product, false, 'single', array(), true, true ) );

    Hope this helps!