I'm doing a Progress Bar Shopping Experience (in my WooCommerce site). First the user select the plan (demo, home, business, premium), then select the products he wants, and finally I've to show them the cart table. I use the following code to send the items using AJAX (In the same template):
<?php
if(isset($_POST['action']))
{
global $woocommerce;
$woocommerce->cart->empty_cart(true);
$woocommerce->cart->add_to_cart( 2932, 30 );
echo do_shortcode('[woocommerce_cart]');
die();
}
?>
<?php get_header(); ?>
<script type="text/javascript">
var serializedOrderForm ='action=update_cart_order';
jQuery.ajax({
type: 'POST',
data: serializedOrderForm
})
.done(function(data){
console.log(data);
jQuery("#p1content3").html(data);
})
.fail(function( jqXHR, textStatus, errorThrown ) {
console.log(jqXHR);
console.log(textStatus);
console.log(errorThrown);
jQuery("#p1content3").html("<div class='alert'>Ha Ocurrido un Error al Procesar la Orden</div>");
});
</script>
<div id="p1content3"></div>
<?php echo do_shortcode('[woocommerce_cart]');?>
<?php get_footer(); ?>
<?php get_sidebar(); ?>
My problem is that the table (the first one) that return the AJAX is WITHOUT the price discounts of the plugin "woocommerce dynamic pricing discounts".
But if inside any template i use:
<? echo do_shortcode('[woocommerce_cart]'); ?>
Its return the table (second table) WITH the price discounts...
You can see the example here: http://cl.galyleo.net/prueba-carro/ of the code with the 2 cases.
Any ideas?
die()
at the end of your function? I'd imagine that'd kill everything that runs AFTER your function is called & completed...? Just a thought.