1. Home
  2. Docs
  3. Cresta Smart Sell for Woo...
  4. Compatibility and Help
  5. For developers

For developers

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

FilterWhat it changes
cresta_ss_cards_titleThe title above the tier cards. Gets the title and the product.
cresta_ss_progress_messageThe message of the progress bar, as plain text. Gets the message and the progress of the thresholds.
cresta_ss_progress_dataEverything the progress bar shows (percent, reached, message, icon), or null for no bar.
cresta_ss_cart_tier_labelThe label of a cart threshold discount, shown in place of its coupon code.
cresta_ss_display_textsThe texts each campaign type shows, with their defaults and tags.
cresta_ss_display_colorsThe colours each campaign type lets the shop owner change.

Filters for the cart

FilterWhat it changes
cresta_ss_cart_item_eligibleWhether campaigns can discount a cart line. Lines of bundles and composite products are left out by default.
cresta_ss_cart_item_countsWhether a cart line counts towards cart thresholds and free gifts.
cresta_ss_cart_item_base_priceThe price a line starts from, before any campaign.
cresta_ss_price_floorThe lowest unit price campaigns may bring a product to. PRO sets it from the cost and the minimum margin.
cresta_ss_currency_rateThe 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_metWhether the current customer meets the conditions of a campaign.

Campaigns and admin

HookTypeWhen
cresta_ss_campaign_savedActionAfter a campaign is inserted or updated. Gets the campaign.
cresta_ss_campaign_deletedActionAfter a campaign is deleted. Gets its id.
cresta_ss_campaign_typesFilterThe campaign types the store can create, slug => label.
cresta_ss_line_rulesFilterThe rules of the per-line discounts, by campaign type.
cresta_ss_campaign_editorsFilterThe editors of the campaign types.
cresta_ss_campaign_sectionsFilterPanels other plugins add to the campaign editor.
cresta_ss_wizard_goalsFilterThe goals of the guided setup.
cresta_ss_translatable_stringsFilterThe texts of a campaign sent to String Translation.
cresta_ss_loadedActionOnce every class of the free plugin is available.
cresta_ss_pro_loadedActionOnce 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_data is yes.
  • Discounted order lines keep the campaign in their meta data.