Open Mohamad-Jaallouk opened 1 year ago
Can you provide a video recording @Mohamad-Jaallouk ?
I ask because your report is a little short.
What are the steps to reproduce?
In review-order.php I use Alpine JS to delete an item:
<button x-data="{}" @click="deleteItem($event)" data-key="<?php echo $cart_item_key; ?>" type="button">DELETE</button>
<script type="text/javascript">
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
// Get the cart_key from the URL
var cartKey = getParameterByName('cocart-load-cart');
function deleteItem(event) {
const itemKey = event.target.getAttribute('data-key');
fetch("https://test2.local/wp-json/cocart/v2/cart/item/" + itemKey +
"?cart_key=" + cartKey, {
method: "DELETE",
headers: {
"Content-Type": "application/json; charset=utf-8"
}
})
.then(response => response.json())
.then(data => {
window.location.reload();
})
.catch(error => {
console.error('Error:', error);
});
}
</script>
The item has been successfully removed, but this warning appears. If I delete all items and start to add new ones, the warning disappears. Once I click the delete button again, it appears once more. I would be happy to share a video if needed after sharing the code.
Prerequisites
Describe the bug
When using "restore item from cart" using Woocommerce Checkout I get:
The product however is removed.
Expected behavior
...
Actual behavior
...
Steps to reproduce
.
WordPress Environment
WP: 6.3.2 PHP: 8.1.23
Isolating the problem