woocommerce_variable_add_to_cart不适用于访客用户

问题描述 投票:7回答:1

我是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' ); 
?>

提前致谢。

php wordpress woocommerce product
1个回答
0
投票

请转到Woocommerce - 设置导航到访客结帐中的“帐户和隐私”勾选“允许客户下订单而无需帐户”enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.