The Zoho SKU System: A Technical Deep Dive
The entire business logic of the EDGE Store plugin revolves around the structured SKU system managed in Zoho CRM. Understanding this system is critical for any developer working on the codebase.
The logic for decoding these SKUs is located in helpers/helpers-zoho.php within the ZohoHelper class.
SKU Structure
The SKU is a string of characters, typically 10 or more, where each position or group of positions has a specific meaning.
| Position (0-indexed) | Function | ZohoHelper Method | Values & Meanings |
|---|---|---|---|
0-3 | Title Code | getProductCode() | A 4-digit code that groups different formats (eBook, print) of the same title. |
4 | CourseBook | hasCourseBook() | 1: CourseBook, 2: Short CourseBook, 0: No |
5 | Textbook / eBook | hasTextBook(), hasEbook() | 1: Textbook (Print), 2: eBook (Digital), 3: Short Textbook (Print), 4: Textbook & eBook Combo (Print) |
6 | Study Guide | hasStudyGuide() | 1: Print, 2: Digital, 0: No |
7 | Workbook | hasWorkBook() | 1: Print, 2: Digital, 0: No |
8 | Edition / Print Coupon | getEdition(), hasPrintCoupon() | If Edition: 1: STD, 2: PRO, 3: LTI. If Coupon: A numeric ID for the coupon type. |
9 | USB | hasUsb() | 1: Yes, 0: No |
Key Logic: skuHasPrint()
This is one of the most important functions in the plugin. It determines whether a product is physical and therefore requires shipping and triggers the Xero bill creation.
A SKU is considered a “print” product if any of the following are true:
- It is a Textbook/eBook combo (
substr($sku, 5, 1) == 4). - It is a print Textbook (
substr($sku, 5, 1) == 1or3). - It is a print Workbook (
substr($sku, 7, 1) == 1). - It is a print Study Guide (
substr($sku, 6, 1) == 1). - It has a Print Coupon (
substr($sku, 8, 1) > 0). - It includes a USB (
substr($sku, 9, 1) == 1). - It is a Leaflet (
str_contains($sku, 'LEAF')).
This logic is central to the order fulfillment and accounting flows.
Practical Example
Let’s decode the SKU 1234141010:
1234: Title Code1: It is a CourseBook.4: It is a Textbook & eBook Combo. This automatically flags it as a print product.1: It includes a print Study Guide.0: It does not include a Workbook.1: It is the STD edition.0: It does not include a USB.
Conclusion: This product is a physical item that includes a CourseBook, a Textbook, an eBook, and a Study Guide. When ordered, it will require shipping and will trigger the creation of a bill in Xero.