问题描述:

I am trying to insert add to cart form.

function testing(){

$product = new Wc_product(14); // 14 = product id

echo $product->get_image().'<br>'.woocommerce_template_single_add_to_cart();

}

add_acttion('wp_footer','testing')

woocommerce_template_single_add_to_cart function is:

function woocommerce_template_single_add_to_cart() {

global $product;

do_action( 'woocommerce_' . $product->product_type . '_add_to_cart' );

}

But $product results in empty [product_type]

I think i am going in wrong direction. Can some one guide how to get add to cart form?

Thanks

相关阅读:
Top