marketing consent to recovery consent and connection with core

This commit is contained in:
elvira
2026-09-09 14:42:23 +03:00
parent 7a8b9cf4c0
commit 46b3f29674
3 changed files with 18 additions and 20 deletions
@@ -164,16 +164,14 @@ public function saveAddress(string $locale, Request $request): JsonResponse
$this->checkout->setBillingAddress($billing);
$cart = $this->checkout->setShippingAddress($shipping);
$cart->meta = [
...($cart->meta?->toArray() ?? []),
'ship_to_billing' => $sameAsBilling,
// Interim storage only — the proper consent record (timestamp,
// policy version) is the back-end Task 2. This just lets the
// checkbox round-trip on reload like every other field.
'marketing_consent' => $request->boolean('marketing_consent'),
];
$cart->meta = [...($cart->meta?->toArray() ?? []), 'ship_to_billing' => $sameAsBilling];
$cart->save();
// Abandoned-cart-recovery opt-in — boboko-core owns the record (bool +
// timestamp + policy version on Cart::meta, RecoveryConsentSet event).
// Deliberately its own scope, not merged with any future newsletter opt-in.
$this->checkout->setRecoveryConsent($request->boolean('recovery_consent'));
// ShippingManifest is a request-lifetime singleton whose getOptions()
// appends without ever clearing, and addOption() keeps the FIRST entry
// per identifier. The setBillingAddress() recalc above ran ApplyShipping