Add to cart on content products page

I’m trying to put an add to cart on my products page (link you can see the “Comprar” button under the price http://zip.net/bwmNFc), I’m trying to put this that I took from add-to-cart/simple.php and put on content-product.php but does not work:

I put this after do_action( 'woocommerce_after_shop_loop_item_title' )

Read More
<form class="cart" method="post" enctype='multipart/form-data'>
<?php do_action( 'woocommerce_before_add_to_cart_button' ); ?>
<?php 
if ( ! $product->is_sold_individually() )
            woocommerce_quantity_input( array(

                'min_value' => apply_filters( 'woocommerce_quantity_input_min', 1, $product ),
                'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->backorders_allowed() ? '' : $product->get_stock_quantity(), $product )
            ) );
    ?>

<input type="hidden" name="add-to-cart" value="<?php echo esc_attr( $product->id ); ?>" />

<button type="submit" class="single_add_to_cart_button button alt"><?php echo $product->single_add_to_cart_text(); ?></button>

<?php do_action( 'woocommerce_after_add_to_cart_button' ); ?>
</form>
<?php do_action( 'woocommerce_after_add_to_cart_form' ); ?>
</div>

If the person clicking the add to cart, add to cart one product that the person chosen to cart.

Related posts

Leave a Reply

1 comment

  1. Would the Add to Cart shortcode work instead?

    [add_to_cart id="99"]
    

    Args:

    array(
          'id' => '99',
          'style' => 'border:4px solid #ccc; padding: 12px;',
          'sku' => 'FOO'
     )