Przejdź do treści
Pomoc
Kreator

How do I add my own HTML, CSS, and JavaScript to a page (Custom code section)?

Use the Custom code section to put your own HTML, CSS, and JavaScript inside a page: how your styles stay inside the section, how your script reaches it, the size limits, who can edit it, and its width, colors, and padding.

3 minuty czytania

The Custom code section lets you build part of a page with your own code, for example a booking widget, a video embed, a map, or a layout no other section offers. It sits on the page where you place it, like any other section.

Add one

  1. Open the builder and go to the page you want.
  2. In the Sections tab, click Add new section and pick Custom code in the Advanced group.
  3. Write your code in the HTML, CSS, and JavaScript boxes, check the preview, and click Publish.

You can add up to 2 per page, on every page except the 403 page. On a product or collection page, a Custom code section can stay on one product or collection only, see How do I add a section to one product or collection only, or remove a shared section from just one?

The three code boxes

  • HTML: the markup shown inside this section. Leave out <html> and <body>, and keep styles and scripts in their own boxes.
  • CSS: styles for this section only. Your store adds the section's own id in front of every selector, so write them as if the section were the whole page. They cannot change the rest of your store.
  • JavaScript: runs each time the section is shown. Your code receives the section as container, so reach your own markup with container.querySelector(...). An error in your script stops only your script, not the page.

Each box holds up to 5,000 characters, and anything longer is cut off. Each one also has a fullscreen button in its bottom corner, next to the character count.

Section settings

  • Section width: Page keeps the content in your page width, Full uses the whole screen width.
  • Color scheme: the background behind your markup. See Color schemes.
  • Padding: the space on each side, up to 200 pixels. It starts at 0.

Who can change it

Only the store owner can add, change, or remove a Custom code section, because its code runs on the pages where customers type their details. When a staff member publishes a change that would touch it, nothing is saved and they see You do not have permission to perform the operation.

Good to know

  • Tags for the head of the page, such as a site verification tag or a pixel, do not work here, because this section sits in the page body. Use the matching app instead, see Settings.
  • A script on every page: use Custom JavaScript. Styles for the whole store: use Custom CSS.
  • The page looks broken after a change: clear the code, publish, and add it back piece by piece.
  • Third party scripts can slow your store down. Add only what you need.

Nadal potrzebujesz pomocy?

Napisz do nas, a odpowiemy.

Kontakt