Query customs harmonized system (HS) codes for products exported to the Philippines using the official Tariff Commission tariff book.
Important Discovery: The tariff book PDFs are hosted on Google Drive, not directly on the government website. The workflow is:
Use the unified query tool for the complete workflow:
python3 ~/.codex/skills/ph-hs-code-finder/scripts/query_hs_code.py "<product_name>"
Example:
python3 ~/.codex/skills/ph-hs-code-finder/scripts/query_hs_code.py "hair dryer"
This will:
First, determine which chapter the product belongs to:
python3 ~/.codex/skills/ph-hs-code-finder/scripts/suggest_chapter.py "<product_name>"
Example:
python3 ~/.codex/skills/ph-hs-code-finder/scripts/suggest_chapter.py "mobile phone charger"
# Output:
# Product: mobile phone charger
# Matched keywords: phone, charger, mobile
# Suggested chapters:
# 1. Chapter 85: Electrical machinery and equipment (score: 30)
Use Playwright to automatically get the Google Drive link and download:
python3 ~/.codex/skills/ph-hs-code-finder/scripts/get_chapter_pdf.py <chapter_number> [output_directory]
Example:
python3 ~/.codex/skills/ph-hs-code-finder/scripts/get_chapter_pdf.py 85 ~/Downloads
What happens:
Once you have the PDF, search for the product:
python3 ~/.codex/skills/ph-hs-code-finder/scripts/search_hs_code.py \
<pdf_path> <keyword1> [keyword2] ...
Example:
python3 ~/.codex/skills/ph-hs-code-finder/scripts/search_hs_code.py \
~/Downloads/Chapter_85.pdf "hair" "dryer" --source "<gdrive_url>"
| Chapter | Category | Example Products |
|---|---|---|
| --------- | ---------- | ------------------ |
| 39 | Plastics | Bags, bottles, containers |
| 61/62 | Apparel | Clothing, garments, fashion |
| 64 | Footwear | Shoes, boots, sandals |
| 73 | Iron/Steel | Hardware, screws, tools |
| 76 | Aluminium | Profiles, sheets, foil |
| 84 | Machinery | Computers, printers, equipment |
| 85 | Electrical | Phones, chargers, electronics |
| 87 | Vehicles | Cars, motorcycles, parts |
| 90 | Optical/Medical | Cameras, instruments, lenses |
| 94 | Furniture | Chairs, tables, bedding |
| 95 | Toys/Sports | Toys, games, exercise equipment |
python3 query_hs_code.py "wireless bluetooth headphone"
If user provides an image:
Example workflow:
# Identify product from image
product = "hair dryer" # identified from image
# Run query
python3 query_hs_code.py "$product"
Install required dependencies:
# Install Python packages
pip install pdfplumber playwright
# Install Playwright browsers
playwright install chromium
The script handles Google Drive downloads automatically:
If automatic download fails:
--pdf flagResults are displayed as markdown table:
## 查询结果: hair dryer
**源文件**: [Google Drive Link](https://drive.google.com/file/d/xxxxx/view)
| HS编码 | 商品描述 | 页码 |
|--------|----------|------|
| 8516.31.00 | Hair dryers | 15 |
| 8516.32.00 | Other hair-dressing apparatus | 15 |
============================================================
✓ RECOMMENDED HS CODE: 8516.31.00
Description: 8516.31.00 - Hair dryers 1 1 1 1 1 1...
============================================================
# Check Playwright installation
playwright install chromium
# Verify Chrome/Chromium is available
which chromium || which google-chrome || which chromium-browser
The website has WAF protection. If direct download fails:
Ensure the PDF is a valid file:
file Chapter_85.pdf
# Should output: PDF document, version 1.x
# Step 1: Suggest chapter
$ python3 suggest_chapter.py "hair dryer"
Product: hair dryer
Matched keywords: hair, dryer
Suggested chapters:
1. Chapter 85: Electrical machinery and equipment
✓ Best match: Chapter 85
# Step 2 & 3: Download and search (combined)
$ python3 query_hs_code.py "hair dryer"
# Output:
============================================================
Philippines HS Code Query: hair dryer
============================================================
Step 1: Analyzing product category...
Product: hair dryer
Matched keywords: hair, dryer
Suggested chapters:
1. Chapter 85: Electrical machinery and equipment (score: 20)
Using top suggestion: Chapter 85
Step 2: Downloading Chapter 85 PDF...
Opening browser to find Chapter 85...
Found link: https://drive.google.com/file/d/xxxxx/view
Downloading Chapter 85...
✓ Downloaded: Chapter_85.pdf (1197.0 KB)
Step 3: Searching HS codes for "hair dryer"...
## 查询结果: hair dryer
**源文件**: [Google Drive](https://drive.google.com/file/d/xxxxx/view)
| HS编码 | 商品描述 | 页码 |
|--------|----------|------|
| 8516.31.00 | - Hair dryers | 15 |
| 8516.32.00 | - Other hair-dressing apparatus | 15 |
============================================================
✓ RECOMMENDED HS CODE: 8516.31.00
============================================================
Every response MUST include:
共 1 个版本