Closed (fixed)
Project:
Basic Cart
Version:
8.x-8.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
30 Oct 2019 at 11:17 UTC
Updated:
5 Nov 2025 at 23:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
l0keComment #3
l0keComment #4
br0kenCan we rely on
isEmpty()method?Comment #5
br0kenSorry, I was viewing the wrong patch.
Comment #6
rachel_norfolkretagging
Comment #8
karthikeyan-manivasagam commentedThanks All for the contribution
Comment #10
norman.lolThis issue resulted in all of the logic inside
basic_cart_entity_presavebeing skipped for everybody, see #3180430: Neither cart content, price or vat are stored in the newly 'order' node and #3214499: Empty Basic cart content.In the long run this needs to get refactored and all that logic removed from the presave hook.
But for now we could at least add a condition in the presave hook to check if
!empty(Utility::getCartData())$cart_data['empty']['status'] === FALSE, because when placing the order, the cart gets only emptied a few milliseconds later inbasic_cart_entity_insert. That way, the only thing you need to make sure when creating nodes programmatically is, that the user pressing the button to start the batch has their cart empty via an initial call to the$utility::emptyCart();method in the beginning.Comment #14
norman.lolOkay,
!empty(Utility::getCartData())always is true no matter what.. but$cart_data['empty']['status'] === FALSEonly is true when there's really stuff in the cart, so let's check on this instead.