• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/internals/facebookconversion.php
  • Класс: BitrixSaleInternalsFacebookConversion
  • Вызов: FacebookConversion::onCustomizeProductHandler
static function onCustomizeProductHandler(int $offerId): void
{
	if (!self::isAllowedRegion())
	{
		return;
	}

	if (!self::checkClass())
	{
		return;
	}

	$params = self::getFacebookConversionParams(FacebookEvent::EVENT_DONATE);
	if (!$params)
	{
		return;
	}

	if ($params[self::ID] !== 'Y')
	{
		return;
	}

	$customDataParams = [
		'content_type' => 'product',
		'content_ids' => [$offerId],
	];

	if ($params[self::NAME_AND_PROPERTIES] === 'Y')
	{
		$skuPropertiesTextValue = self::getSkuNameAndPropertiesTextValue($offerId);
		if ($skuPropertiesTextValue)
		{
			$customDataParams['content_name'] = $skuPropertiesTextValue;
		}
	}

	self::fireEvent(FacebookEvent::EVENT_DONATE, $customDataParams);
}