Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Added

- Creation of a new appSettings (false by default) `disableProduct` - used to disable the product enrichment in Product structured data (JSON-LD).

## [0.16.0] - 2025-07-18

## [0.15.0] - 2025-04-28
Expand Down
6 changes: 6 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@
],
"default": "ean",
"description": "Set the value used for GTIN"
},
"disableProduct": {
"title": "Disable Product",
"type": "boolean",
"default": false,
"description": "Disable product"
}
}
},
Expand Down
5 changes: 5 additions & 0 deletions react/Product.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,13 @@ function StructuredData({ product, selectedItem }) {
useImagesArray,
disableAggregateOffer,
gtinValue,
disableProduct
} = useAppSettings()

if (disableProduct) {
return null;
}

const productLD = parseToJsonLD({
product,
selectedItem,
Expand Down
7 changes: 6 additions & 1 deletion react/hooks/useAppSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const DEFAULT_USE_SELLER_DEFAULT = false
const DEFAULT_USE_IMAGES_ARRAY = false
const DEFAULT_DISABLE_AGGREGATE_OFFER = false
const DEFAULT_GTIN_VALUE = 'itemId'
const DEFAULT_DISABLE_PRODUCT = false

interface Settings {
disableOffers: boolean
Expand All @@ -17,7 +18,8 @@ interface Settings {
useSellerDefault: boolean
useImagesArray: boolean
disableAggregateOffer: boolean
gtinValue?: string
gtinValue?: string,
disableProduct?: boolean
}

const useAppSettings = (): Settings => {
Expand All @@ -32,6 +34,7 @@ const useAppSettings = (): Settings => {
useImagesArray,
disableAggregateOffer,
gtinValue,
disableProduct
} = JSON.parse(data.publicSettingsForApp.message)

return {
Expand All @@ -43,6 +46,7 @@ const useAppSettings = (): Settings => {
disableAggregateOffer:
disableAggregateOffer || DEFAULT_DISABLE_AGGREGATE_OFFER,
gtinValue: gtinValue || DEFAULT_GTIN_VALUE,
disableProduct: disableProduct || DEFAULT_DISABLE_PRODUCT,
}
}

Expand All @@ -54,6 +58,7 @@ const useAppSettings = (): Settings => {
useImagesArray: DEFAULT_USE_IMAGES_ARRAY,
disableAggregateOffer: DEFAULT_DISABLE_AGGREGATE_OFFER,
gtinValue: DEFAULT_GTIN_VALUE,
disableProduct: DEFAULT_DISABLE_PRODUCT,
}
}

Expand Down