payment fix

This commit is contained in:
elvira
2026-09-15 19:20:59 +03:00
parent 1598f053ee
commit ba6d68c5b9
5 changed files with 155 additions and 96 deletions
@@ -215,6 +215,15 @@ export default class extends Controller {
return
}
// Points at the section that actually needs attention, rather than
// leaving a generic error and making the shopper hunt for it — e.g. a
// region with 2+ shipping methods needs an explicit pick, easy to miss.
if (data.field === 'shipping_option') {
document.getElementById('bbk-shipping-options')?.scrollIntoView({ block: 'center', behavior: 'smooth' })
this.fail(data.message || data.error || this.genericErrorValue, { scroll: false })
return
}
this.fail(data.message || data.error || this.genericErrorValue)
}
@@ -252,15 +261,15 @@ export default class extends Controller {
// ── helpers ──────────────────────────────────────────────────────
fail(message) {
this.showError(message)
fail(message, { scroll = true } = {}) {
this.showError(message, { scroll })
this.submitTarget.disabled = false
}
showError(message) {
showError(message, { scroll = true } = {}) {
this.errorTarget.textContent = message
this.errorTarget.hidden = false
this.errorTarget.scrollIntoView({ block: 'center', behavior: 'smooth' })
if (scroll) this.errorTarget.scrollIntoView({ block: 'center', behavior: 'smooth' })
}
clearError() {