Hi,
-When I call the function do_action( 'woocommerce_simple_add_to_cart' ); my button "add to cart" is visible
-When I replace it with this function do_action( 'woocommerce_ajax_add_to_cart' );
no button are created. (no errors are returned)
-var_dump(do_action( 'woocommerce_ajax_add_to_cart' ));
returns NULL
-I'm working on templates/content-product.php (i've enabled AJAX from the admin panel)
By the way, when I use this bbcode [add_to_cart id="" sku=""] to create an "add to cart" button in the description of the product it works perfectly (ajax).
Here is my code :
<?php
/*
template/content-product.php page
*/
global $product, $woocommerce_loop;
if ( empty( $woocommerce_loop['loop'] ) )
$woocommerce_loop['loop'] = 0;
if ( empty( $woocommerce_loop['columns'] ) )
$woocommerce_loop['columns'] = apply_filters( 'loop_shop_columns', 4 );
if ( ! $product->is_visible() )
return;
$woocommerce_loop['loop']++;
?>
<?php do_action( 'woocommerce_before_shop_loop_item' ); ?>
<div class="column-right-product">
<?php $product = new WC_Product( get_the_ID() ); ?>
blah blah blah
<?php
/* here is the problem */
//do_action( 'woocommerce_simple_add_to_cart' );
do_action( 'woocommerce_ajax_add_to_cart' );
?>
</div>
thank you very much for your help,
Nicolas