woocommerce_variable_add_to_cart不适用于访客用户

时间:2018-03-14 07:21:58

标签: php wordpress woocommerce product

我是WordPress / WooCommerce的新手。 我正在尝试从可变产品中弹出的fancybox制作快速查看,添加到购物车功能。

我找到并写下了代码;当客户登录时它正在工作,但对于访客用户而言,它显示的消息是产品已添加到购物车但在实际购物车中它没有添加。

我正在使用

WordPress version: 4.3.1

WooCommerce version: 2.4.12 

插件:woocommerce-ajax-add-to-cart-for-variable-products

<?php
include 'wp-load.php';
?>
<script src="<?php echo get_site_url() ?>/jquery.min.js"></script>

<script type='text/javascript' src='<?php echo get_site_url() ?>/wp-content/plugins/woocommerce/assets/js/frontend/single-product.min.js'></script>

<script type='text/javascript' src='<?php echo get_site_url() ?>/wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart.min.js'></script>

<script type='text/javascript' src='<?php echo get_site_url() ?>/wp-content/plugins/woocommerce-ajax-add-to-cart-for-variable-products/js/add-to-cart-variation.min.js'></script>

<script type='text/javascript' src='<?php echo get_site_url() ?>/wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart-variation.min.js'></script>

<?php global $product, $woocommerce, $yith_wcwl_init; ?>
<?php wc_print_notices(); ?>
<?php
woocommerce_variable_add_to_cart();
echo do_action( 'woocommerce_add_to_cart_form' ); 
?>

提前致谢。

1 个答案:

答案 0 :(得分:0)

请转到Woocommerce-设置 导航到“帐户和隐私” 在来宾结帐中勾选“允许客户不使用帐户下订单” enter image description here