shopify-admin-profit-margin-calculator
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "shopify-admin-profit-margin-calculator" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-e5dacc580f1ffb2f5baa2f75e10c373e93eb34901891f1fe4d6808d633e0f89f. Verify the upstream source and version against https://github.com/40RTY-ai/shopify-admin-skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Read-only: Calculate true net profit per order and per product by accounting for cost of goods sold, shipping, transaction fees, discounts, refunds, and taxes.
Introduction source: third_party · 40RTY-ai · 0.0.1 Reference
SkillPi interpretation
- Tasks
- Read-only: calculates true net profit per order and per product by factoring in COGS, shipping costs, transaction fees, discounts, refunds, and taxes.
- Inputs and outputs
- CSV file `profit_report_<YYYY-MM-DD>.csv` with columns: `order_id`, `order_name`, `date`, `revenue`, `cogs`, `shipping`, `discounts`, `tx_fees`, `refunds`, `net_profit`, `margin_pct` For product grouping: `product_id`, `product_title`, `vendor`, `units_sold`, `revenue`, `cogs`, `net_profit`, `margin_pct`
- Software, accounts and paid services
- Authenticated Shopify CLI session: `shopify store auth --store <domain> --scopes read_orders,read_products,read_inventory` API scopes: `read_orders`, `read_products`, `read_inventory` For accurate results, products should have `inventoryItem.unitCost` populated
- Testing
- Not tested
Browse files
Frontmatter
name: shopify-admin-profit-margin-calculator
role: finance
description: "Read-only: calculates true net profit per order and per product by factoring in COGS, shipping costs, transaction fees, discounts, refunds, and taxes."
toolkit: shopify-admin, shopify-admin-execution
api_version: "2025-01"
graphql_operations:
- orders:query
- inventoryItems:query
- productVariants:query
status: stable
compatibility: Claude Code, Cursor, Codex, Gemini CLIPurpose
Calculates true net profit and margin at both order-level and product-level granularity. Unlike basic revenue reports, this skill deducts all cost components — COGS (from inventoryItem.unitCost), shipping costs, transaction/payment processing fees, applied discounts, refund amounts, and duties/taxes — to surface actual margin percentages. Read-only — no mutations.
Prerequisites
- Authenticated Shopify CLI session:
shopify store auth --store <domain> --scopes read_orders,read_products,read_inventory - API scopes:
read_orders,read_products,read_inventory - For accurate results, products should have
inventoryItem.unitCostpopulated
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| store | string | yes | — | Store domain (e.g., mystore.myshopify.com) |
| days_back | integer | no | 30 | Lookback window for orders |
| group_by | string | no | order | Grouping: order, product, or variant |
| min_orders | integer | no | 1 | Minimum orders for a product to appear (product/variant mode) |
| include_refunded | boolean | no | true | Include fully refunded orders in calculation |
| format | string | no | human | Output format: human or json |
Safety
ℹ️ Read-only skill — no mutations are executed. Safe to run at any time.
Workflow Steps
-
OPERATION:
orders— query Inputs:query: "created_at:>='<NOW - days_back days>'",first: 250, selectid,name,createdAt,totalPriceSet,subtotalPriceSet,totalShippingPriceSet,totalTaxSet,totalDiscountsSet,currentTotalPriceSet,displayFinancialStatus,refunds { totalRefundedSet },lineItems { variant { id, inventoryItem { id, unitCost { amount, currencyCode } } }, quantity, originalTotalSet, discountedTotalSet }, pagination cursor Expected output: All orders in window with full cost breakdown -
OPERATION:
inventoryItems— query Inputs: Batch ofinventoryItemIdsfrom line item variants for any missing unitCost data Expected output: Unit cost for each inventory item -
For each order, calculate:
- Revenue =
currentTotalPriceSet.shopMoney.amount - COGS = Σ(lineItem.quantity × variant.inventoryItem.unitCost)
- Shipping Cost =
totalShippingPriceSet.shopMoney.amount(merchant-paid portion estimate) - Discounts =
totalDiscountsSet.shopMoney.amount - Transaction Fee = estimated at 2.9% + $0.30 of total (configurable)
- Refunds = Σ(refunds.totalRefundedSet.shopMoney.amount)
- Net Profit = Revenue - COGS - Shipping - Transaction Fee - Refunds
- Margin % = (Net Profit / Revenue) × 100
- Revenue =
-
If
group_by: productorvariant, aggregate profits by product/variant across all orders -
OPERATION:
productVariants— query (enrichment) Inputs: Variant IDs from profitable/unprofitable items for product title context Expected output: Product titles, SKUs for display
GraphQL Operations
# orders:query — validated against api_version 2025-01
query OrdersWithCosts($query: String!, $after: String) {
orders(first: 250, after: $after, query: $query) {
edges {
node {
id
name
createdAt
displayFinancialStatus
totalPriceSet { shopMoney { amount currencyCode } }
subtotalPriceSet { shopMoney { amount currencyCode } }
totalShippingPriceSet { shopMoney { amount currencyCode } }
totalTaxSet { shopMoney { amount currencyCode } }
totalDiscountsSet { shopMoney { amount currencyCode } }
currentTotalPriceSet { shopMoney { amount currencyCode } }
refunds {
totalRefundedSet { shopMoney { amount currencyCode } }
}
lineItems(first: 50) {
edges {
node {
quantity
originalTotalSet { shopMoney { amount currencyCode } }
discountedTotalSet { shopMoney { amount currencyCode } }
variant {
id
sku
inventoryItem {
id
unitCost { amount currencyCode }
}
product {
id
title
}
}
}
}
}
}
}
pageInfo { hasNextPage endCursor }
}
}
# inventoryItems:query — validated against api_version 2025-01
query InventoryItemCosts($ids: [ID!]!) {
nodes(ids: $ids) {
... on InventoryItem {
id
unitCost { amount currencyCode }
}
}
}
# productVariants:query — validated against api_version 2025-01
query VariantDetails($ids: [ID!]!) {
nodes(ids: $ids) {
... on ProductVariant {
id
sku
title
product { id title vendor }
}
}
}
Session Tracking
Claude MUST emit the following output at each stage. This is mandatory.
On start, emit:
╔══════════════════════════════════════════════╗
║ SKILL: Profit & Margin Calculator ║
║ Store: <store domain> ║
║ Started: <YYYY-MM-DD HH:MM UTC> ║
╚══════════════════════════════════════════════╝
After each step, emit:
[N/TOTAL] <QUERY|MUTATION> <OperationName>
→ Params: <brief summary of key inputs>
→ Result: <count or outcome>
On completion, emit:
For format: human (default):
══════════════════════════════════════════════
PROFIT & MARGIN REPORT (<days_back> days)
Orders analyzed: <n>
Total Revenue: $<amount>
Total COGS: $<amount>
Total Shipping: $<amount>
Total Tx Fees: $<amount>
Total Refunds: $<amount>
─────────────────────────────
Net Profit: $<amount>
Overall Margin: <pct>%
Top profitable products:
"<product>" Margin: <pct>% Profit: $<n>
Bottom margin products:
"<product>" Margin: <pct>% Profit: $<n>
Output: profit_report_<date>.csv
══════════════════════════════════════════════
For format: json, emit:
{
"skill": "profit-margin-calculator",
"store": "<domain>",
"period_days": 30,
"orders_analyzed": 0,
"total_revenue": 0,
"total_cogs": 0,
"total_shipping": 0,
"total_tx_fees": 0,
"total_refunds": 0,
"net_profit": 0,
"overall_margin_pct": 0,
"currency": "USD",
"output_file": "profit_report_<date>.csv"
}
Output Format
CSV file profit_report_<YYYY-MM-DD>.csv with columns:
order_id, order_name, date, revenue, cogs, shipping, discounts, tx_fees, refunds, net_profit, margin_pct
For product grouping: product_id, product_title, vendor, units_sold, revenue, cogs, net_profit, margin_pct
Error Handling
| Error | Cause | Recovery |
|---|---|---|
THROTTLED |
API rate limit exceeded | Wait 2 seconds, retry up to 3 times |
| Missing unitCost | Product COGS not set | Flag as "unknown COGS" — include in report but exclude from margin calc |
| Refunded orders | Fully refunded | Include with $0 net revenue if include_refunded: true |
Best Practices
- Populate
inventoryItem.unitCoston all products for accurate COGS. Without it, margins cannot be calculated. - Adjust transaction fee estimate based on your payment processor (default 2.9% + $0.30 matches Shopify Payments US).
- Use
group_by: productto identify which products are margin-positive vs. margin-negative. - Cross-reference with
stock-velocity-reportto find fast-selling but low-margin items that may need repricing. - Use results with
bulk-price-adjustmentto increase prices on margin-negative products.
Version history
-
v1.1.0
GitHub ↗
Original release notes
## 🤖 New category: Agentic Commerce Readiness The fix-it side of the [**agentiq.report**](https://agentiq.report) audit. The audit tells operators *where* AI shopping agents (ChatGPT, Gemini, Perplexity, agentic checkout) can't find, read, or recommend their store. This release adds **10 skills that remediate those findings** via the native Shopify Admin GraphQL toolkit — closing the loop: **audit finds the gap → run the matching skill → re-audit confirms.** Every skill declares the audit **signals** it fixes (`audit_signals` frontmatter), so a finding in the report maps directly to the skill that resolves it. ### Skills - **`agentic-readiness-audit`** — flagship, read-only store-side scorecard that routes each gap to its fix skill - **`agentic-product-jsonld-backfill`** — barcode/GTIN, vendor, product type for complete Product JSON-LD - **`agentic-image-alt-text`** — descriptive alt text on product media - **`agentic-description-enrichment`** — fact-rich descriptions for AI quoting - **`agentic-metafields-setup`** — define + populate agentic metafields for filtering - **`agentic-product-taxonomy`** — Shopify Standard Product Taxonomy categories - **`agentic-crawler-access`** — allow GPTBot/ClaudeBot/PerplexityBot… in `robots.txt.liquid` - **`agentic-llms-txt`** — publish a curated `/llms.txt` for AI assistants - **`agentic-organization-schema`** — Organization JSON-LD (sameAs, contactPoint) into the theme - **`agentic-policy-readability`** — machine-readable shipping/returns policies Plus a weekly **`agentic-readiness-monitor`** routine that re-audits and alerts on regressions. ### Stats **116 skills across 11 categories** (was 106/10), **21 routines** (was 20). All GraphQL validated against the live Admin 2025-01 schema; `pnpm validate:index` passes (116 skills, 64 operations). ### Notes Theme-editing and policy skills default to `dry_run`/`audit` mode, write inside managed `# BEGIN/END` blocks, and recommend duplicating the theme first.
Current listing version
0.0.1
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 高价值工具:直接解决电商运营核心痛点,计算真实净利润和利润率
- 功能全面:涵盖COGS、运费、交易费用、折扣、退款和税费等所有成本项
- 多维度分析:支持订单级和产品级粒度分析
- 实用性强:提供CSV导出和JSON格式输出
Highlights
- 触发词精准完整:description清晰描述了技能的核心功能
- 边界清晰:明确说明只读操作,不会执行任何变更
- 覆盖全面:包含多种参数选项和使用场景
Highlights
- 结构清晰:包含Purpose、Prerequisites、Parameters、Safety、Workflow Steps等完整章节
- 步骤明确:详细列出了5个执行步骤和对应的GraphQL操作
- 示例完整:提供了完整的GraphQL查询示例和输出格式说明
- 规范完整:frontmatter包含所有必要字段
Highlights
- 工具来源明确:使用Shopify Admin API,版本明确为2025-01
- 参数正确:所有GraphQL查询都经过验证
- 异常处理完善:覆盖了API限流、缺失unitCost、退款订单等场景
- 安全机制:明确标注为只读操作,无风险
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Authenticated Shopify CLI session: `shopify store auth --store <domain> --scopes read_orders,read_products,read_inventory` API scopes: `read_orders`, `read_products`, `read_inventory` For accurate results, products should have `inventoryItem.unitCost` populated
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.