woocommerce_variable_add_to_cart not working for guest user

I am new to WordPress/WooCommerce. I am trying to make Quick View, Add To Cart function from pop up fancybox in Variable Products.

I found and wrote below code; it’s working when a customer is logged in but for guest user its showing message that product is added to cart but in the actual cart it’s not adding.

I am using

WordPress version: 4.3.1

WooCommerce version: 2.4.12

Plugin: 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’ );
?>

Read more here:: woocommerce_variable_add_to_cart not working for guest user

Leave a Reply

Your email address will not be published. Required fields are marked *