Wordpress woocommerce\u模板\u单个\u添加到\u购物车特定产品id
我正在尝试在我的网站主页上显示预订表单(WooCommerce预订插件)。我已经创建了一个小部件空间,在这个小部件中,我想为特定产品调用函数Wordpress woocommerce\u模板\u单个\u添加到\u购物车特定产品id,wordpress,woocommerce,widget,webhooks,Wordpress,Woocommerce,Widget,Webhooks,我正在尝试在我的网站主页上显示预订表单(WooCommerce预订插件)。我已经创建了一个小部件空间,在这个小部件中,我想为特定产品调用函数woocommerce\u template\u single\u add\u to\u cart 到目前为止,我已经: <?php $post_id = '2100'; if ( !function_exists( 'woocommerce_template_single_add_to_cart' ) ) { require
woocommerce\u template\u single\u add\u to\u cart
到目前为止,我已经:
<?php
$post_id = '2100';
if ( !function_exists( 'woocommerce_template_single_add_to_cart' ) ) {
require_once '/includes/wc-template-functions.php';
}
$result = woocommerce_template_single_add_to_cart($post_id);
?>
但它不会从id=2100的产品中输出预订表单
欢迎提供任何帮助。是否回显
$result
?是否回显$result
?