The actions, filters and CSS variables you can use to adapt Cresta Smart Sell from a theme or a small plugin.
CSS variables
The shop elements use these variables, set on :root or on any parent element. The colours set in a campaign win over them.
:root {
--cresta-ss-accent: #1f6feb;
--cresta-ss-success: #1a7f37;
--cresta-ss-warning: #b54708;
--cresta-ss-radius: 8px;
}
Filters for the shop
| Filter | What it changes |
|---|---|
cresta_ss_cards_title | The title above the tier cards. Gets the title and the product. |
cresta_ss_progress_message | The message of the progress bar, as plain text. Gets the message and the progress of the thresholds. |
cresta_ss_progress_data | Everything the progress bar shows (percent, reached, message, icon), or null for no bar. |
cresta_ss_cart_tier_label | The label of a cart threshold discount, shown in place of its coupon code. |
cresta_ss_display_texts | The texts each campaign type shows, with their defaults and tags. |
cresta_ss_display_colors | The colours each campaign type lets the shop owner change. |
Filters for the cart
| Filter | What it changes |
|---|---|
cresta_ss_cart_item_eligible | Whether campaigns can discount a cart line. Lines of bundles and composite products are left out by default. |
cresta_ss_cart_item_counts | Whether a cart line counts towards cart thresholds and free gifts. |
cresta_ss_cart_item_base_price | The price a line starts from, before any campaign. |
cresta_ss_price_floor | The lowest unit price campaigns may bring a product to. PRO sets it from the cost and the minimum margin. |
cresta_ss_currency_rate | The rate from the store currency to the currency of the cart prices, for fixed discounts. Leave it at 1 when cart prices are in the store currency. |
cresta_ss_campaign_conditions_met | Whether the current customer meets the conditions of a campaign. |
Campaigns and admin
| Hook | Type | When |
|---|---|---|
cresta_ss_campaign_saved | Action | After a campaign is inserted or updated. Gets the campaign. |
cresta_ss_campaign_deleted | Action | After a campaign is deleted. Gets its id. |
cresta_ss_campaign_types | Filter | The campaign types the store can create, slug => label. |
cresta_ss_line_rules | Filter | The rules of the per-line discounts, by campaign type. |
cresta_ss_campaign_editors | Filter | The editors of the campaign types. |
cresta_ss_campaign_sections | Filter | Panels other plugins add to the campaign editor. |
cresta_ss_wizard_goals | Filter | The goals of the guided setup. |
cresta_ss_translatable_strings | Filter | The texts of a campaign sent to String Translation. |
cresta_ss_loaded | Action | Once every class of the free plugin is available. |
cresta_ss_pro_loaded | Action | Once every class of PRO is available. |
Example
Keep a product out of every campaign, here the gift cards with id 120:
add_filter( 'cresta_ss_cart_item_eligible', function ( $eligible, $item ) {
return 120 === (int) $item['product_id'] ? false : $eligible;
}, 10, 2 );
Data
- Campaigns are stored in their own table,
{prefix}cresta_ss_campaigns. - Deleting the plugin keeps them unless the option
cresta_ss_delete_dataisyes. - Discounted order lines keep the campaign in their meta data.