How to adapt Cresta Checkout with code: custom CSS, hooks and filters, and blocks of your own. Internal names start with cresta_bc_, whatever the plugin is called.
Custom CSS
Every style of the plugin starts with #cbc-app, the wrapper of the three pages. Start your selectors the same way and they’ll win over the plugin’s. Each block is wrapped in an element with the classes cbc-block cbc-block--{type} and a data-cbc-id attribute, for example cbc-block--trust_badges.
#cbc-app .cbc-block--trust_badges {
border-top: 1px solid #e5e7eb;
padding-top: 16px;
}
With PRO, paste your CSS in Settings → Advanced → Custom CSS. It loads only on the pages of the plugin.

Without PRO, add it from a small plugin or a code snippet. Stylesheets of themes are left out of these pages, so add the CSS to the plugin’s own stylesheet:
add_action( 'wp_enqueue_scripts', function () {
wp_add_inline_style( 'cresta-bc-frontend', '#cbc-app .cbc-block--trust_badges { padding-top: 16px; }' );
}, 40 ); // After the plugin, which loads its styles at priority 30.
Turn the design off for some buyers
Cresta_BC_Frontend::current_page() returns cart, checkout, thankyou or an empty string, and the filter cresta_bc_current_page can change the answer. Return an empty string to give a page back to WooCommerce:
// Wholesale customers keep the WooCommerce checkout.
add_filter( 'cresta_bc_current_page', function ( $page ) {
if ( 'checkout' === $page && in_array( 'wholesale_customer', (array) wp_get_current_user()->roles, true ) ) {
return '';
}
return $page;
} );
Filters
| Filter | Arguments | What it changes |
|---|---|---|
cresta_bc_current_page | $page | The page handled by the plugin, see above. |
cresta_bc_layout | $layout, $page | The layout printed on the storefront. The builder always edits the stored one. |
cresta_bc_options | $options | The values of the Settings panel, as read on the storefront. |
cresta_bc_block_visible | $visible, $instance, $page | Whether a block is printed. Display conditions use it. |
cresta_bc_block_classes | $classes, $instance | The classes of a block wrapper. |
cresta_bc_block_refreshes | $refreshes, $instance | Whether a block is printed again after each update of the cart. |
cresta_bc_block_fields | $fields, $block | The settings of a block. PRO adds the display conditions here. |
cresta_bc_app_classes | $classes, $page | The classes of the #cbc-app wrapper. |
cresta_bc_keep_theme_assets | $handles | Style and script handles of the theme to keep on these pages. |
cresta_bc_isolated_style_paths | $paths | The URL paths whose stylesheets are left out: the themes folder and the uploads folder. |
cresta_bc_templates | $templates | The templates of the builder, keyed by page. |
cresta_bc_skins | $skins | The skins, keyed by id. |
cresta_bc_token_fields | $fields | The design settings of the Style panel. |
cresta_bc_option_fields | $fields | The fields of the Settings panel. |
cresta_bc_font_stacks | $stacks | The fonts offered in the Style panel. |
cresta_bc_frontend_data | $data | The data passed to the storefront script. |
cresta_bc_builder_data | $data | The data passed to the builder. |
cresta_bc_cart_response | $payload, $op, $page | The answer of the plugin’s cart requests. |
cresta_bc_delivery_wait_gateways | $gateways | PRO. Payment methods that ship only once paid, for the delivery estimate. Default array( 'bacs', 'cheque' ). |
For example, to keep the stylesheet of a payment plugin that is enqueued from your theme folder:
add_filter( 'cresta_bc_keep_theme_assets', function ( $handles ) {
$handles[] = 'my-gateway-style';
return $handles;
} );
Actions
| Action | Arguments | When it fires |
|---|---|---|
cresta_bc_loaded | none | Once every class of the free plugin is available. Register your blocks here: PRO starts from it too. |
cresta_bc_saved | $request | After the builder has saved, with the REST request. |
cresta_bc_cart_action | $op, $page | For a cart request the plugin doesn’t know, so that your blocks can handle their own. |
A block of your own
A block is a class that extends Cresta_BC_Block, registered on cresta_bc_loaded. It shows up in the builder like the others, with its settings in the side panel.
add_action( 'cresta_bc_loaded', function () {
class My_Shop_Notice_Block extends Cresta_BC_Block {
public $type = 'my_shop_notice';
public function title() {
return __( 'Shop notice', 'my-shop' );
}
public function description() {
return __( 'A short message for your buyers.', 'my-shop' );
}
public function pages() {
return array( 'cart', 'checkout' );
}
public function fields() {
return array(
'text' => array(
'type' => 'text',
'label' => __( 'Text', 'my-shop' ),
'default' => __( 'Orders placed today ship tomorrow.', 'my-shop' ),
),
);
}
public function render( $settings, $page ) {
echo '<p class="my-shop-notice">' . esc_html( $settings['text'] ) . '</p>';
}
}
Cresta_BC_Blocks::register( new My_Shop_Notice_Block() );
} );
Only title() and render() are required. The other methods have defaults you can override:
| Method | Default | Purpose |
|---|---|---|
description() | empty | The short text under the name in the builder. |
icon() | layers | An icon name of Cresta_BC_Icons. |
pages() | cart, checkout | Pages the block can go on: cart, checkout, thankyou. |
category() | conversion | Group in the library: essential, conversion or content. |
zones() | all four | Zones it can be dropped in: header, main, sidebar, footer. |
unique() | false | Whether it can be used only once per page. |
required( $page ) | false | Required blocks can’t be removed. |
shared() | false | The builder copies its settings to the other pages it’s on. |
refreshes() | false | Printed again after each update of the cart, for blocks that depend on it. |
fields() | none | Its settings, see below. |
preview( $settings, $page ) | calls render() | What the builder shows. Override it when the block reads the cart, which is empty in the builder. |
Each setting in fields() has a type, a label and a default, and optionally a help text. The types are text, textarea, html, url, number, range, toggle, select, color, image, product, term and list. Some keys only apply to some types:
optionsfor aselect, as value => label;min,maxandunitfor numbers and ranges;fieldsandaddfor alist, the settings of each item and the text of the button that adds one;show_ifshows the setting only when others have some values, for examplearray( 'amount_type' => array( 'fixed' ) );moneyset to true marks an amount in the shop currency, converted for multi-currency shops;translateset to false keeps a text out of String Translation.
Settings are cleaned according to their type before they’re saved, and render() gets them merged over the defaults. Escape what you print, as in the example.
Where the data lives
| Data | Stored in |
|---|---|
| Layouts | Options cresta_bc_layout_cart, cresta_bc_layout_checkout, cresta_bc_layout_thankyou |
| Settings panel and design | Options cresta_bc_options and cresta_bc_design |
| Order bump line | Order item meta _cresta_bc_bump, the id of the block |
| Reward bar gift | Order item meta _cresta_bc_reward, the step it comes from |
| Reward bar discount | A coupon line with the code cresta-reward, made in memory |
| Message of a fee | Fee item meta _cresta_bc_note and _cresta_bc_note_label |
| Next order coupon | Order meta _cresta_bc_next_coupon with the code, coupon meta _cresta_bc_from_order with the order id |
To see a page without the plugin while you debug, add ?cbc=off to its address while logged in as a shop manager.