Skip to content

Update checkout page - #548

Merged
Vladyslav-Kuksiuk merged 18 commits into
masterfrom
update-checkout
Aug 14, 2026
Merged

Update checkout page#548
Vladyslav-Kuksiuk merged 18 commits into
masterfrom
update-checkout

Conversation

@Vladyslav-Kuksiuk

Copy link
Copy Markdown
Collaborator

This PR updates the checkout page and checkout-completed page according to the latest changes from the Company-Site versions of those pages.

Checkout page

image image

Order not found

image

Transaction in progress

image

Payment completed

image

Payment failed

image

Resolves this issue.

@Vladyslav-Kuksiuk Vladyslav-Kuksiuk self-assigned this Aug 13, 2026
@Vladyslav-Kuksiuk
Vladyslav-Kuksiuk marked this pull request as ready for review August 13, 2026 15:30

@JuliaEvseeva JuliaEvseeva left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Vladyslav-Kuksiuk, please see minor UI comments.

Comment thread site/assets/scss/modules/_forms.scss Outdated
Comment thread site/assets/scss/modules/_forms.scss Outdated
Comment thread site/assets/scss/modules/_forms.scss Outdated
Comment thread site/assets/scss/modules/_forms.scss Outdated
Comment thread site/assets/scss/modules/_result-panel.scss
Comment thread site/assets/scss/pages/_checkout.scss Outdated
Comment thread site/assets/scss/pages/_checkout.scss Outdated
Comment thread site/assets/scss/pages/_checkout.scss
Comment thread site/assets/scss/pages/_checkout.scss Outdated
Comment thread site/assets/scss/modules/_forms.scss
Comment thread site/layouts/_partials/components/result-panel.html Outdated
Comment thread site/layouts/checkout-completed/single.html Outdated
Comment thread site/layouts/checkout/single.html Outdated
Comment thread site/assets/scss/pages/_checkout.scss Outdated
Comment thread site/assets/js/pages/checkout/form-controller.js
Comment thread site/assets/js/pages/checkout/index.js Outdated
window.setTimeout(() => {
const restoredState = formController.getBrowserRestoredCountryState();

phoneCountryManuallySelected = Boolean(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This derivation misfires for the common case where the user never touched the phone country.

The phone field is initialised to us (initPhoneNumberField()), and syncPhoneCountryState() writes that into #checkout-phone-country. So a visitor who opens checkout, types their email, navigates away and presses Back restores phoneCountryCode: 'US' with billingCountryCode: '' — and 'US' !== '' sets phoneCountryManuallySelected = true.

From then on applyPhoneCountryFromBillingCountry() is a no-op, so selecting "Germany" as the billing country leaves the phone prefix at +1.

On a bfcache restore this is doubly wrong: the closure variable survived the navigation and already held the correct false, and this line overwrites it.

Comment thread site/layouts/checkout-completed/single.html
Comment thread site/assets/js/pages/checkout/completed.js
Comment on lines +45 to +47
{{ with site.Params.payment.standardsupportproductid }}
{{ $productId = . }}
{{ end }}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The override sits inside the range, so it replaces the product ID of every column rather than just the standard-support one.

services.json has two header_cols: "Standard Support Pack" (with paygate_product_id) and "Custom Support" (deliberately without one). With standardSupportProductId configured, the second column also gets data-paygate-product-id. It happens to be harmless today only because pricing.js reads the first match of $('[data-paygate-product-id]').

Scoping the override to columns that already declare a product ID keeps the intent:

Suggested change
{{ with site.Params.payment.standardsupportproductid }}
{{ $productId = . }}
{{ end }}
{{ if $productId }}
{{ with site.Params.payment.standardsupportproductid }}
{{ $productId = . }}
{{ end }}
{{ end }}

}

/** Shows the resolved order summary and billing form. */
function showCheckoutView() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

showSummaryLoading, showSummaryError, showCheckoutView, showMissingOrderView and showNotFoundView are five copies of the same six-line block — toggle $loading / $summary / $form / $missingOrder / $notFound / $summaryError, differing only in which one stays visible plus the setResultPageMode flag.

completed.js already has the generic form of exactly this (showView(activeViewId) iterating the view IDs). A small map from panel name to {element, isResultPage} would drop ~30 lines here and make it impossible to forget a panel when a sixth one is added.

Comment on lines +523 to +528
const buildChargeRequest = (orderId, buyerCountryCode, vatId) => {
if (!orderId || !buyerCountryCode) return null;
return vatId
? {orderId, buyerCountryCode, vatId}
: {orderId, buyerCountryCode};
};

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

buildChargeRequest is re-implemented here instead of being imported, and the copy is byte-for-byte the current charge-request.js body.

The real module is already loaded at the top of this file via importSource('../assets/js/pages/checkout/charge-request.js'), so the harness can inject that export. As written, a behaviour change in charge-request.js cannot fail any charge-controller test, and the two copies can drift silently.

Comment thread .github/workflows/check-links.yml Outdated
Comment on lines +111 to +114
- name: Run checkout tests
if: steps.docs.outputs.present == 'true'
working-directory: ${{ steps.docs.outputs.work_dir }}
run: npm test

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JS unit suite is wired into the link-check workflow and gated on steps.docs.outputs.present == 'true', so it only runs when a docs preview is being built, and a unit-test failure is reported to contributors as a link-check failure.

These tests do not depend on the rendered site at all. A dedicated job (or an existing build workflow) would run them on every PR and report under their own name.

Comment on lines +64 to +66
countries.forEach(country => {
select.add(new Option(country.name, country.code));
});

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appends ~250 options one at a time, each mutating the live <select> during page load and immediately before Select2 re-reads it. Building into a DocumentFragment and appending once makes it a single mutation:

Suggested change
countries.forEach(country => {
select.add(new Option(country.name, country.code));
});
const options = document.createDocumentFragment();
countries.forEach(country => {
options.append(new Option(country.name, country.code));
});
select.append(options);
}

Comment thread site/assets/scss/pages/_checkout.scss Outdated
Comment on lines +253 to +255
.form-select {
appearance: auto;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.form-select is dead under .checkout .form-section after this PR: #checkout-country changed from class="form-input form-select" to class="form-input country-select", and the phone country <select> was removed entirely. Nothing in the checkout markup carries the class any more.

This whole appearance: auto rule can go, and .form-select can be dropped from the .form-input, .form-select selector on line 247.

return true;
}

if (field.type === 'tel') {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This returns true for any type="tel" field before the field.required check, so a required phone input would silently pass validateRequiredFields().

Today it is unreachable — #checkout-phone is not required, and bindEvents() routes the phone field to its own blur -> validatePhoneNumber handler rather than here. It reads like a guard but is dead code that would misbehave the moment it becomes live.

Comment thread site/assets/js/pages/checkout/index.js Outdated
phoneCountryManuallySelected = false;
formController.restoreCountryState({
billingCountryCode: '',
phoneCountryCode: 'US'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'US' duplicates the default phone country from form-controller.js (initialCountry: normalizeCountryCode(dom.$phoneCountry.val()) || 'us'), in a different case.

Exporting a single default from the form controller would keep the reload reset and the initial render from drifting apart.

@Oleg-Melnik Oleg-Melnik left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Vladyslav-Kuksiuk LGTM with comments to address.

@Vladyslav-Kuksiuk
Vladyslav-Kuksiuk merged commit 9fa38a8 into master Aug 14, 2026
3 checks passed
@Vladyslav-Kuksiuk
Vladyslav-Kuksiuk deleted the update-checkout branch August 14, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants