generated from boboko/starter
marketing consent to recovery consent and connection with core
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -77,9 +77,9 @@ private function lines(): array
|
||||
'page.guest_tab' => ['Guest', 'Ως επισκέπτης'],
|
||||
'page.login_tab' => ['Log in', 'Σύνδεση'],
|
||||
'page.email_label' => ['Email', 'Email'],
|
||||
'page.marketing_consent' => [
|
||||
'Email me offers, news and order reminders',
|
||||
'Στείλε μου προσφορές, νέα και υπενθυμίσεις παραγγελιών',
|
||||
'page.recovery_consent' => [
|
||||
"Email me a reminder if I don't finish my order",
|
||||
'Στείλε μου μια υπενθύμιση αν δεν ολοκληρώσω την παραγγελία μου',
|
||||
],
|
||||
'page.login_email_label' => ['Email', 'Email'],
|
||||
'page.send_code' => ['Send code', 'Αποστολή κωδικού'],
|
||||
|
||||
@@ -63,21 +63,21 @@ class="bbk-checkout-tab"
|
||||
form="bbk-address-form"
|
||||
/>
|
||||
|
||||
{{-- One combined marketing opt-in (offers + news + unfinished-order
|
||||
reminders). Optional, unticked, never required — all of it is
|
||||
direct marketing under ePrivacy (GR L. 3471/2006 art. 11), so it
|
||||
needs an explicit opt-in and checkout can't be gated on it.
|
||||
The bool round-trips via cart.meta (see saveAddress); the proper
|
||||
consent record — timestamp, policy version — is back-end Task 2. --}}
|
||||
{{-- Abandoned-cart-recovery opt-in. Optional, unticked, never
|
||||
required — direct marketing under ePrivacy (GR L. 3471/2006
|
||||
art. 11), so it needs an explicit opt-in and checkout can't be
|
||||
gated on it. Narrow scope by design (boboko-core's
|
||||
setRecoveryConsent) — a general newsletter opt-in, if wanted,
|
||||
is a separate checkbox. --}}
|
||||
<label class="bbk-checkbox bbk-checkbox--stacked">
|
||||
<input
|
||||
type="checkbox"
|
||||
name="marketing_consent"
|
||||
name="recovery_consent"
|
||||
value="1"
|
||||
form="bbk-address-form"
|
||||
{{ old('marketing_consent', data_get($cart, 'meta.marketing_consent')) ? 'checked' : '' }}
|
||||
{{ old('recovery_consent', data_get($cart, 'meta.recovery_consent')) ? 'checked' : '' }}
|
||||
>
|
||||
{{ __('checkout.page.marketing_consent') }}
|
||||
{{ __('checkout.page.recovery_consent') }}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user