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.
Kindly goto Woocommerce - Settings Navigate to "Account and Privacy" in Guest Checkout tick "Allow customers to place orders without an account"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With