Development of Social Commerce System in 1C-Bitrix
Social commerce — sales through mechanisms of social interaction: reviews with ratings, wishlists, group purchases, referral programs, likes and product sharing. Each mechanism either lowers purchase barrier (social proof) or expands reach (virality). Bitrix has part of them in basic package, part requires development.
Reviews and ratings module
Bitrix has built-in reviews via reviews component and ratings via vote. For full social commerce need to extend:
Verified purchases — review can be left only by user who bought product. Check: b_sale_order_basket contains PRODUCT_ID in completed orders of USER_ID. Add condition to PHP handler before review creation via CIBlockElement::AddSection() or custom bl_product_reviews table.
Photos in reviews — standard reviews component doesn't support media. Create own component with AJAX file upload via \CFile::SaveFile() and review link via custom bl_review_media table.
Sorting by helpfulness — "Helpful/Not helpful" buttons with voting via \Bitrix\Vote\VoteTable. Result used for ranking reviews by default.
Wishlists and wish lists
Wishlist — user's named list of products. Build system on custom table:
// Structure of bl_wishlists table
// wishlist_id, user_id, name, is_public, share_token, created_at
// Structure bl_wishlist_items
// id, wishlist_id, product_id, added_at, note
class WishlistService
{
public static function addItem(int $userId, int $productId, ?string $wishlistName = null): void
{
$wishlistId = self::getOrCreateDefault($userId, $wishlistName);
// Check if product already exists
$exists = WishlistItemTable::getRow([
'filter' => ['WISHLIST_ID' => $wishlistId, 'PRODUCT_ID' => $productId],
]);
if (!$exists) {
WishlistItemTable::add([
'WISHLIST_ID' => $wishlistId,
'PRODUCT_ID' => $productId,
'ADDED_AT' => new \Bitrix\Main\Type\DateTime(),
]);
}
}
public static function shareWishlist(int $wishlistId): string
{
$token = bin2hex(random_bytes(16));
WishlistTable::update($wishlistId, ['SHARE_TOKEN' => $token, 'IS_PUBLIC' => 1]);
return '/wishlist/shared/' . $token;
}
}
Public wishlist page accessible via URL with token — other user can add products directly to cart. Works as viral mechanism, especially in gift categories.
Group purchases
Group purchase — user creates "group order", invites others, at target quantity price drops. Implementation:
bl_group_purchases table: id, product_id, creator_user_id, target_qty, current_qty, discount_pct, price_with_discount, expires_at, status.
bl_group_purchase_members table: group_id, user_id, joined_at, paid.
When current_qty >= target_qty agent changes status = active and sends notifications. Each participant pays their share at reduced price — separate order in b_sale_order created with discount.
Referral program
Referral mechanism: user gets unique link, distributes in social networks. Visiting link, new visitor sees special offer or discount. On purchase — referrer gets bonus.
// Generate referral link
$refCode = base64_encode($userId . '-' . crc32($userId . SITE_SECRET));
$refLink = 'https://' . SITE_SERVER_NAME . '/?ref=' . $refCode;
// Handler for incoming traffic (in init.php or component)
$refCode = $_GET['ref'] ?? null;
if ($refCode && !isset($_SESSION['ref_code'])) {
$_SESSION['ref_code'] = $refCode;
setcookie('ref_code', $refCode, time() + 86400 * 30, '/');
}
// On order creation — credit bonus to referrer
AddEventHandler('sale', 'OnSaleOrderSaved', function(\Bitrix\Sale\Order $order) {
$refCode = $_COOKIE['ref_code'] ?? null;
if ($refCode) {
$referrerId = ReferralService::getUserIdByCode($refCode);
if ($referrerId && $referrerId !== $order->getUserId()) {
BonusService::credit($referrerId, $order->getPrice() * 0.05); // 5% of purchase
}
}
});
Product sharing in social networks
"Share" buttons in product card — standard share links. To track shares add AJAX endpoint that records event in bl_share_events(product_id, user_id, network, created_at) and returns UTM link with user ID for attributing sales via social traffic.
Open Graph and meta tags for social networks
When sharing, social network parses Open Graph tags of product page. In catalog.element template add:
<meta property="og:title" content="<?= htmlspecialchars($arResult['NAME']) ?>"/>
<meta property="og:description" content="<?= htmlspecialchars($arResult['PREVIEW_TEXT']) ?>"/>
<meta property="og:image" content="https://<?= SITE_SERVER_NAME ?>/<?= \CFile::GetPath($arResult['PREVIEW_PICTURE']) ?>"/>
<meta property="og:price:amount" content="<?= $arResult['CATALOG_PRICE_1']['PRICE'] ?>"/>
<meta property="og:price:currency" content="RUB"/>
Implementation timeline
| Component | Complexity | Timeline |
|---|---|---|
| Verified reviews with photos | Medium | 5–7 days |
| Wishlists with public access | Medium | 4–6 days |
| Referral program | Medium | 5–8 days |
| Group purchases | High | 10–15 days |
| Open Graph and sharing with attribution | Low | 2–3 days |
What we develop
- System of verified reviews with purchase history check and media support
- Wishlists with public links for social network sharing
- Referral program with tracking via cookie/UTM and bonus accrual
- Group purchase mechanism with quantity thresholds and time limits
- Open Graph meta tags for correct product display when sharing







