Skip to main content

Campaign Plugin

Storefront campaign pricing plugin config with helpers for ordinary/campaign price handling.

Disclaimer: This module depends on compatible plugin behavior being active in the consumer's Vendure backend instance. Configure the backend first, then register this plugin config in the storefront.

Purpose

Use this module when you need campaign-aware pricing in product, search, and order contexts and want one shared way to compute ordinary prices.

Features

  • Extends search/product/order queries with ordinaryPrice
  • Exposes VendureCampaignPlugin for DataProvider pluginConfigs
  • Exposes isCampaign utility to compare ordinary and active prices
  • Augments shared storefront types with campaign-related fields

Installation

npm install @haus-storefront-react/vendure-plugin-configs

Note: This is not a public package. Contact the Haus Tech Team for access.

API Reference

Utilities

isCampaign

Compares ordinary price and current price values across PriceRange, SinglePrice, and numeric inputs.

Exports

  • VendureCampaignPlugin
  • isCampaign
  • CampaignFeatures type

Basic Usage

Example 1: Register Plugin in Data Provider

Use this to configure and register the campaign plugin in your provider pluginConfigs.

import { VendureCampaignPlugin } from '@haus-storefront-react/vendure-plugin-configs/campaign'

const campaignPlugin = VendureCampaignPlugin.init({
enableFeatures: {
showCampaignPrices: true,
ordinaryPrice: true,
},
})

Example 2: Consume Plugin Functionality

Use this in application pricing logic after the plugin has been registered.

import { isCampaign } from '@haus-storefront-react/vendure-plugin-configs/campaign'

export function CampaignLabel({ product }) {
const hasCampaign = isCampaign(product.ordinaryPrice, product.priceWithTax)
return <p>{hasCampaign ? 'Campaign price' : 'Regular price'}</p>
}

Made with ❤️ by Haus Tech Team