Appearance
Custom CSS Classes & IDs
Add your own CSS class to blocks the app shows on your storefront, so your theme's CSS can restyle them.
Overview
Some parts of the options form aren't single options. The price summary is one of them: the "Total Extras" box below the options that lists each priced option and the total. The Custom CSS classes & IDs section in Storefront Settings lets you add your own class to that box. Write CSS for that class in your theme to restyle it.
The section is empty by default and changes nothing until you fill it in.
Use it to:
- Match the price summary to your theme: colours, borders, spacing, fonts
- Restyle the summary only on certain themes or pages, by adding the class to rules you control
- Hook the summary up to your own JavaScript
Per-option classes are set elsewhere
To add a class or ID to a single option, use the CSS class and CSS ID fields in that option's Advanced Settings. See CSS Class & CSS ID. This section is for the app's own blocks that aren't options.
Settings
| Block | Setting | Options (default) | What it controls |
|---|---|---|---|
| Price summary | CSS class | text (empty) | One or more class names added to the price summary box. In-app help: Separate several classes with spaces. A leading "." is removed for you. |
The section shows one block for now, the price summary, and it takes classes only.
How to Add a Class
- Navigate to App Settings > Storefront Settings
- Open Price Display Settings and make sure Display below options is on. Without it, product pages don't show the price summary
- Open Custom CSS classes & IDs
- Under Price summary, type a class name in CSS class, for example
my-price-box - Click Save in the contextual save bar
- Add CSS for the class to your theme (see Styling the Price Summary)
- Check the result in your theme editor's preview or on your storefront
The preview here doesn't use your theme's CSS
Your styling lives in your theme, so it won't show in the app's Storefront Settings preview. The section says so too. Check it in the theme editor's preview or on a product page.
If Display below options is off, the section shows a note that product pages don't show the price summary right now. You can still save a class. It applies in the Edit in cart modal, which always shows the summary, and on product pages once you turn the summary on.
Typing the Value
Type the class name only. You can type several classes separated by spaces.
| What you type | Class added to the price summary |
|---|---|
my-price-box | my-price-box |
.my-price-box | my-price-box (the leading . is removed) |
promo featured | promo and featured |
| (empty) | nothing, and the price summary keeps only the app's own classes |
Your class is added next to the app's own key_price_summary class, never instead of it, so the app's styling keeps working.
Values that can't be saved
These show an error under the field, and saving is blocked with the message Fix the highlighted CSS class before saving.
| Message | Cause |
|---|---|
| Classes starting with key_ are reserved for the app's own styles. Choose a different name. | A class name starts with key_ |
| Quotes, angle brackets, backticks and backslashes can't be used in a CSS class. | The value contains ", ', <, >, a backtick or a backslash |
| Use 255 characters or fewer. | The value is longer than 255 characters |
To remove your class, clear the field and save.
Styling the Price Summary
Add your CSS to the theme, not to the app. In Shopify admin, go to Online Store > Themes > Customize > Theme settings > Custom CSS. Use the theme-wide Custom CSS rather than a section's own Custom CSS, which only applies inside that section. If your theme has no Custom CSS box, use Edit code and add your rules to the end of the theme's main stylesheet (for example assets/base.css).
The parts of the price summary
Your class sits on the outer box. Every part inside it has a fixed class starting with key_price_summary, which you can combine with yours to reach that part:
| Class | Part of the price summary |
|---|---|
key_price_summary | The outer box. Your class is added here |
key_price_summary__card | The card: background, border, corners |
key_price_summary__body | The content inside the card |
key_price_summary__title | The "Total Extras" heading |
key_price_summary__row | Every line: the base price, each option, and the total |
key_price_summary__row--base | The base product price line (shown when the product has a price) |
key_price_summary__row--option | Each priced option line |
key_price_summary__label | The text on a line, e.g. "Size: Large:" |
key_price_summary__amount | The price on a line |
key_price_summary__divider | The line above the total |
key_price_summary__total | The total line |
key_price_summary__total-label | "Total Price:" or "Options Total:" |
key_price_summary__total-amount | The total amount |
The total reads Total Price when the product has a base price, and Options Total when it doesn't.
Example
With my-price-box saved as the class, this CSS gives the summary a yellow dashed card, an orange uppercase title, italic labels, an orange line above the total and a larger green total:
css
/* The outer box: your class sits on this element */
.my-price-box {
padding: 24px 0;
}
/* The card */
.my-price-box .key_price_summary__card {
background: #fff4cc;
border: 2px dashed #e6a700;
border-radius: 0;
}
/* The "Total Extras" heading */
.my-price-box .key_price_summary__title {
color: #b35900;
text-transform: uppercase;
letter-spacing: 1px;
}
/* The text on each line */
.my-price-box .key_price_summary__label {
font-style: italic;
}
/* The line above the total */
.my-price-box .key_price_summary__divider {
background-color: #e6a700;
height: 2px;
}
/* The total */
.my-price-box .key_price_summary__total-amount {
color: #0a7d32;
font-size: 22px;
}You don't need !important: the app's own price summary styles are written so that a rule using your class overrides them.
Check it's applied
On a product page, pick an option with a price, right-click the price summary and choose Inspect. The outer element should read class="key_price_summary my-price-box".
Behavior Notes
- Product page and Edit in cart. The class is added to the price summary on the product page and in the Edit in cart modal
- Nothing else changes. Saving a class doesn't change any other storefront setting, your price selector, or your style templates
- No class, same look. Without a class the price summary looks as it always has. One improvement applies to every store: the thin line above the total now shows on themes that used to hide it, such as Dawn
Related
- Price Display Settings — turn on Display below options to show the price summary
- CSS Class & CSS ID — add a class or ID to a single option
- Storefront Settings — all storefront settings
- Customization Overview — the built-in styling settings to try before writing CSS