Support » Plugin: WooCommerce » 'woocommerce_ajax_add_to_cart' button not visible

  • nicolas-t



    -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 :

    	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() )
    <?php do_action( 'woocommerce_before_shop_loop_item' ); ?>
    <div class="column-right-product">
    	<?php $product = new WC_Product( get_the_ID() ); ?>
        	blah blah blah
    	/* here is the problem */
    	//do_action( 'woocommerce_simple_add_to_cart' );
    	do_action( 'woocommerce_ajax_add_to_cart' );

    thank you very much for your help,


  • The topic ‘'woocommerce_ajax_add_to_cart' button not visible’ is closed to new replies.