Trendyol Tech

Trendyol Tech Team

E-Export: How We Manage the Saleability of International Products

--

The E-Export Journey of Trendyol Sellers

Trendyol enables Turkish sellers to reach customers in other countries abroad as of 2023. The E-Export journey of a product requires collaboration among multiple teams and various processes. In this article, we will outline the steps a product sold in Turkey goes through when being sold in another country.

The Assortment domain generally manages the sellability of products in other countries and facilitates the translation of products listed in the Turkish catalog into the languages used by the targeted countries where sales are planned.

Products on Trendyol are managed within the Product Core team to create catalogs. Here, information about the product is available, such as attributes, categories, content, media, descriptions, etc. The product is being sold for Turkey here. When determining the sellability of a product for overseas markets, the assortment domain collaborates with the Product Core team to utilize the product catalog for Turkey.

The assortment team uses many rules to manage the e-export flow. These rules include the following:

  • Legal Rule
  • International Rule (IRULE)
  • Coefficient Rate Rule
  • Storefront Attribute Required (SAR)
  • Storefront Attribute Suggested (SAS)
  • Content Blacklist

How is The System Managed?

When a rule is saved, a Domain Event is created using the Outbox Pattern, and for each onMutate hook triggered on the collection, an Outbox Event is moved to a separate Outbox Event Collection by the Eventing Function. The Outbox Collection, via the Couchbase to Kafka Connector, sends events to the relevant topic on Apache Kafka® using the Data Change Protocol (DCP).

Outbox Implementation of Assortment Domain

During the execution of created rules and for applications that will read data from the read APIs, we utilize Elasticsearch as a replica database to benefit from the indexing structure. The assortment domain is structurally write-intensive, and we direct the read load from Couchbase to the replica Elasticsearch. To use this replica database structure, we employ the Couchbase to Elasticsearch Connector. We utilize Trendyol’s library for the open-source go-cbes implementation here.

I have a feeling you’re asking what Eventing Function, Kafka Connector, CBES, and Outbox Pattern are. Let me explain them briefly;

Couchbase Eventing Function: Couchbase Eventing Functions are JavaScript functions that automatically run when specific events occur, enabling data processing and workflow automation without adding extra load to your application code. They allow you to customize database operations easily.

Couchbase to Kafka Connector: The Couchbase to Kafka connector is a tool that transfers data from Couchbase to Kafka. This connection enables real-time data streams to be transported to Kafka for data processing. In this way, changes in Couchbase are rapidly propagated to consumer applications in Apache Kafka.

Couchbase to Elasticsearch Connector (CBES): CBES replicates your documents from Couchbase Server to Elasticsearch in near real time. The connector uses the high-performance Database Change Protocol (DCP) to receive notifications when documents change in Couchbase.

Outbox Pattern: The “outbox pattern” is a software architecture term commonly used in message-based systems. It involves placing outgoing messages into an outbox before forwarding them to a processor for handling, ensuring reliable communication by addressing potential errors or glitches during message processing.

Now, let’s look at what these rules are and how they work, one by one.

What is Legal Rule?

A Legal Rule is a rule created to verify the legal saleability of products across countries. While a product may be saleable in Turkey, it might not be possible to sell it in other countries due to various reasons. Therefore, the aim is to manage this process by defining Legal Rules. Legal Rule definition is based on Category and Brand. Matching Content for Category + Brand implies legal suitability for international sales.

{
"categoryId": 111,
"brandId": 222,
"allowedStorefronts": [
{
"storefrontId": 2,
"fulfillmentTypes": ["MP"]
},
{
"storefrontId": 8,
"fulfillmentTypes": ["MP", "FT"]
},
{
"storefrontId": 12,
"fulfillmentTypes": ["ST"]
},
{
"storefrontId": 14,
"fulfillmentTypes": ["FT"]
}
]
}

What is International Rule?

Just because a product is legally sellable doesn’t mean it will be listed for sale. This is because, after products are deemed legally sellable, a seller-specific International Rule (IRULE) definition is created if the seller wishes to list those particular products.

IRULE operates additionally to break down the saleability status on a listing basis according to the following filters: supplier, content, variant, category, brand, fulfillmentType. If a listing passes through these filters, we record in the International Listing (IListing) document in which countries and with which fulfilmentType it can be sold.

{
"supplierId": 761,
"sellerBarcode": "ASSOR-761",
"ft": "MP",
"storefrontRules": [
{
"id": 2,
"status": "OPEN"
},
{
"id": 12,
"status": "OPEN"
},
{
"id": 35,
"status": "OPEN"
},
{
"id": 36,
"status": "OPEN"
}
]
}

When a seller expresses a desire to engage in micro exports, an event sent through the SPM team is consumed, and an IRULE is created for the seller’s sellerId and the countries they wish to perform micro exports to.

IRULEs can operate actively (open) as well as passively. This means that when a passive rule is defined, the saleability of IListings that hit the relevant filter becomes false.

What is The Coefficient Rate Rule?

To reflect factors such as VAT rates, operational costs, etc., when selling a product from Turkey to different countries, a Coefficient Rate Rule is defined. Coefficient Rate Rules can be defined based on content, listing, or category for the country where the product is planned to be sold. If multiple definitions hit on a single content, we accept the most specific one. The logic in this hierarchy is as follows: listing > content > category.

According to the defined business rule, the price multiplier of the product is maintained on IListing. When a coefficient rule is defined, the International-Content consumes this Domain Event and maintains the Coefficient Rate for the relevant storefront on the International Content document.

{
"id": 11694846,
"storefronts": [
{
"id": 2,
"eligible": false,
"coefficientRate": 1.65,
"reasons": []
},
{
"id": 35,
"eligible": true,
"coefficientRate": 1.27,
"reasons": []
}
]
}

What are Storefront Attribute Rules?

The definitions of SAR (Storefront Attribute Required) and SAS (Storefront Attribute Suggested) indicate the required or suggested status of the product’s attributes within which storefront, category, and attributes.

There are two different purposes for SAR and SAS definitions:

  1. Aim to improve catalog quality by ensuring completeness of feature information within products.
  2. Ensure compliance with regulations in certain countries regarding product specifications when selling products in e-export legally.

For example, SAR definition indicates that washing instruction information is mandatory in various countries. The SAS definition suggests that complete Size information is recommended in various countries.

If there is a SAR definition but the relevant attribute is missing on the product, the product falls into SAR_FAILED status, and its sale is blocked in the relevant country. The seller can open the sale of the product by filling in the relevant attribute. If there is a SAS definition but the relevant attribute is missing on the product, the product falls into SAS_FAILED status, but it remains available for sale in the relevant country. The seller is informed about filling in the relevant attribute and is recommended to fill it to improve the product quality. The statuses of being suggested or required are stored in the document of the respective content, and missing attribute information is recorded on a country basis.

{
"id": 11235813,
"storefronts": [
{
"id": 35,
"eligible": true,
"coefficientRate": 1.27,
"reasons": [
{
"message": "Missing Suggested Storefront Attribute(s)",
"type": "SUGGESTED_ATTRIBUTE_MISSING"
}
]
},
{
"id": 36,
"eligible": true,
"coefficientRate": 1.21,
"reasons": [
{
"message": "Missing Required Storefront Attribute(s)",
"type": "REQUIRED_ATTRIBUTE_MISSING"
}
]
}
]
}

Translation Processes

The translation process begins for sellable products, and an international product is created. For the translation process, the Translation team’s API is utilized to request the fields such as category, attribute, attribute value, brand, content description, etc., that hit the content to be translated, along with the target language for the country where the product will be sold. The Translation team completes this process asynchronously and shares the translated content to the topics consumed by the international-content-api.

Each content’s commonly used attributes, categories, brands, etc., are stored in Couchbase DB and replicated to Elasticsearch Read Replica with Cbes. This prevents unnecessary retranslation of already translated fields, but if there’s any change, these translations are updated. The international-content-api creates documents for the sellable countries using these translations.

Eligibility Processes

The sellability of an IListing for an International product does not imply it can be sold as a micro-export. It also needs to be eligible for the respective country’s content. The purpose of calculating eligibility is to manage the micro-export availability for the respective country by passing through certain filters. Some of these filters include:

  1. Poor quality of product content.
  2. Content containing prohibited items.
  3. Legal issues.
  4. Cultural issues.
  5. Products with high volume or difficult to ship.

For an International product to have its Eligibility calculated, there must be a LegalRule definition. If there’s no LegalRule definition, the International product won’t enter the eligibility flow. To calculate the Eligibility of an International product, the QES team sends a request to the inspector-api. (For details on Eligibility calculation, refer to Chapter 3.) QES communicates the analysis results of the relevant International product via events through Kafka. These events are consumed to update the eligibility and reasons in the document for the countries under the respective International product. If there’s already an eligibility value on the International-Content and it changes after receiving an event from QES, after updating the International product document, this change is produced as an event to the SPI team.

Conclusion

This article aimed to outline the primary responsibilities of Trendyol’s Assortment team and the technologies they utilize within the e-export system. We have discussed how the translation, rule definition, and calculation of micro-export sellability processes are managed when a product from Turkey is sold in different countries abroad, including the technologies involved.

Special Thanks

I sincerely thank Göksel Küçükşahin for his contributions to writing this article together.

About Us

Would you like to be a part of our growing company? Join us! Check out our open positions and other media pages from the links below.

--

--

No responses yet