Hello J2Commerce-Team,
while upgrading an old j2store instance, we encountered an error with the "easycheckout" component - it seems, it is impossible to check out when using the "register as new user" directly in the checkout process.
i let my AI-Agent analyse the problem, see summary below:
--------
Problem Summary: When a guest user checks out and selects "Create account" during the EasyCheckout process, the checkout fails with error J2STORE_CHECKOUT_NO_SHIPPING_ADDRESS_FOUND. This happens even when the "Same as billing" checkbox for shipping address is selected.
Root Cause Analysis: In components/com_easycheckout/controllers/checkouts.php, the method validate_register_billing_address() (line ~1390) only validates the address data but does not save the addresses to the database.
The addresses are only saved later in saveBillingAndShipping() when process_type=submit is called. However, after the user is created and logged in during validation, the validateOrder() method (called in confirm() method) expects shipping_address_id to be present in the session for logged-in users.
The session check at line ~108 in administrator/components/com_j2store/models/orders.php fails because:
if($user->id && $session->has('shipping_address_id', 'j2store')) {
$shipping_address = $address_model->getItem(...);
} elseif($session->has('guest', 'j2store')) {
// Guest branch - not taken because user is now logged in
}
Suggested Fix: The addresses should be saved immediately during validate_register_billing_address() after successful validation and user creation, similar to how saveBillingAndShipping() handles it. The user creation and login should happen during validation, not deferred to submit.
---------
The Fix, the AI provided seems to work for now, but it would be great if this could be fixed in future versions.
Thanks and best regards from innsbruck,
bernhard