Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 

Plugins: 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' ); 
?>

Thanks In Advance.

like image 874
user2134 Avatar asked Mar 14 '18 07:03

user2134


1 Answers

Kindly goto Woocommerce - Settings Navigate to "Account and Privacy" in Guest Checkout tick "Allow customers to place orders without an account" enter image description here

like image 196
rushabhpathak Avatar answered Nov 01 '22 22:11

rushabhpathak