문제

I have a product designer on my woocommerce site and when someone goes to edit it, instead of it editing the current cart item, it creates a new one.

The problem is it also leaves the old one. I have the cart-item-key. How can I tell woocommerce to delete the old one after the new item is added? Without generating and making a user click the remove link...

도움이 되었습니까?

해결책

I did this via an AJAX call.

<?php
global $woocommerce;
$removeUrl = $woocommerce->cart->get_remove_url();
?>
<script>
jQuery(document).ready(function($) {
    $.get( '<?php echo $removeUrl; ?>', function( data ) { /**/ });
});
</script>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top