woo-shipping

Build WooCommerce shipping methods — WC_Shipping_Method, shipping zones, shipping classes, rate calculation, tracking, and integration with carriers. Use when creating custom shipping integrations or configuring shipping logic.

17 stars

Best use case

woo-shipping is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Build WooCommerce shipping methods — WC_Shipping_Method, shipping zones, shipping classes, rate calculation, tracking, and integration with carriers. Use when creating custom shipping integrations or configuring shipping logic.

Teams using woo-shipping should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/woo-shipping/SKILL.md --create-dirs "https://raw.githubusercontent.com/OrcaQubits/agentic-commerce-skills-plugins/main/dist/antigravity/woocommerce-commerce/.agent/skills/woo-shipping/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/woo-shipping/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How woo-shipping Compares

Feature / Agentwoo-shippingStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Build WooCommerce shipping methods — WC_Shipping_Method, shipping zones, shipping classes, rate calculation, tracking, and integration with carriers. Use when creating custom shipping integrations or configuring shipping logic.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# WooCommerce Shipping Method Development

## Before writing code

**Fetch live docs**:
1. Web-search `site:developer.woocommerce.com shipping method api` for shipping method guide
2. Web-search `woocommerce custom shipping method tutorial` for implementation patterns
3. Fetch `https://woocommerce.github.io/code-reference/classes/WC-Shipping-Method.html` for class reference

## Shipping Architecture

### Shipping Zones

Geographic regions that determine available shipping methods:
- Zone = set of geographic rules (countries, states, postcodes)
- Each zone has one or more shipping methods assigned
- "Locations not covered by your other zones" = default catch-all zone
- Zones are evaluated in order — first match wins

### Shipping Classes

Product-level classification for rate customization:
- Assign products to shipping classes (e.g., "Heavy Items", "Fragile")
- Shipping methods can define different rates per class
- Managed in WooCommerce > Settings > Shipping > Shipping Classes

## WC_Shipping_Method

### Base Class

All custom shipping methods extend `WC_Shipping_Method`:

| Property | Description |
|----------|-------------|
| `$id` | Unique method identifier |
| `$method_title` | Admin-facing title |
| `$method_description` | Admin-facing description |
| `$title` | Customer-facing title |
| `$enabled` | Whether method is enabled |
| `$instance_id` | Zone instance ID |
| `$supports` | Supported features array |

### Registration

Filter `woocommerce_shipping_methods`:
```php
add_filter( 'woocommerce_shipping_methods', function( $methods ) {
    $methods['my_shipping'] = 'My_Shipping_Method';
    return $methods;
});
```

## Implementation Methods

### Required Methods

- **`__construct( $instance_id )`** — set `$id`, `$method_title`, `$supports`, initialize settings
- **`init_form_fields()`** — define settings fields (flat rate, per-item, per-class)
- **`calculate_shipping( $package )`** — compute rates and add via `$this->add_rate()`

### calculate_shipping()

Receives `$package` array containing:
- `contents` — cart items in this package
- `destination` — shipping address (country, state, postcode, city)
- `cart_subtotal` — package subtotal

Returns rates via `$this->add_rate()`:
```php
$this->add_rate( [
    'id'       => $this->get_rate_id(),
    'label'    => $this->title,
    'cost'     => $calculated_cost,
    'taxes'    => '', // empty = auto-calculate, 'false' = tax-free
    'calc_tax' => 'per_order', // or 'per_item'
    'package'  => $package,
]);
```

### Instance Settings

For zone-based configuration (per-zone settings):
- Set `$this->instance_form_fields` instead of `$this->form_fields`
- Add `'instance-settings'` and `'instance-settings-modal'` to `$this->supports`
- Settings are stored per zone instance, not globally

## Shipping Packages

### What Packages Are

Cart items grouped for shipping calculation:
- Default: all items in one package
- Filter `woocommerce_cart_shipping_packages` to split items into multiple packages
- Each package is calculated independently (different rates for different groups of items)

### Package Format

```php
$package = [
    'contents'        => [ /* cart items */ ],
    'contents_cost'   => 50.00,
    'applied_coupons' => [],
    'destination'     => [
        'country'  => 'US',
        'state'    => 'CA',
        'postcode' => '90210',
        'city'     => 'Beverly Hills',
    ],
];
```

## Rate Calculation Patterns

### Flat Rate

Fixed cost regardless of cart contents. Optionally add per-item or per-class surcharges.

### Weight-Based

Calculate from total package weight:
- Sum `$item['data']->get_weight() * $item['quantity']` for all items
- Apply rate tiers (e.g., $5 for 0-1kg, $10 for 1-5kg)

### Table Rate

Complex rate calculation based on combinations of weight, item count, destination, and price. Often implemented with rate tables stored in custom DB tables.

### Live API Rates

Call carrier APIs (UPS, FedEx, USPS, DHL):
- Send package dimensions, weight, origin, destination
- Receive available services and rates
- Cache responses (transients) to avoid excessive API calls
- Handle API failures gracefully with fallback rates

## Tracking

### Adding Tracking Data

Store tracking info as order meta:
- `$order->update_meta_data( '_tracking_number', $number )`
- `$order->update_meta_data( '_tracking_provider', $carrier )`
- Display in order emails and My Account via hooks

## Free Shipping

Built-in `WC_Shipping_Free_Shipping` — enable based on:
- Minimum order amount
- Coupon with free shipping
- Both (coupon AND minimum amount)

## Best Practices

- Cache rate calculations (transients) for API-based methods
- Handle API failures with fallback/default rates
- Support shipping classes for per-product rate customization
- Use instance settings for per-zone configuration
- Validate destination before calculating rates
- Return multiple rate options when available (e.g., Standard, Express, Overnight)
- Add tracking support for customer transparency
- Test with various cart compositions (single item, multiple, heavy, virtual mix)

Fetch the WooCommerce shipping method documentation for exact method signatures, package format, and instance settings patterns before implementing.

Related Skills

spree-shipping-fulfillment

17
from OrcaQubits/agentic-commerce-skills-plugins

Build and customize Spree's shipping and fulfillment — ShippingMethod, ShippingCategory, Zone/ZoneMember, ShippingRate, the Stock::Estimator service, StockLocation/StockItem/StockMovement, multi-shipment orders, ShippingCalculator classes (FlatRate, FlatPercentItemTotal, PerItem, FlexiRate), shipment state machine, returns (ReturnAuthorization → CustomerReturn → Reimbursement → Refund), and integrating carrier APIs (UPS, FedEx, ShipStation). Use when configuring shipping rules, building fulfillment integrations, or debugging shipping-rate calculations.

saleor-shipping

17
from OrcaQubits/agentic-commerce-skills-plugins

Configure Saleor shipping — shipping zones, methods (price/weight-based), custom shipping Apps, warehouse-based allocation, and click-and-collect. Use when setting up delivery options.

woo-testing

17
from OrcaQubits/agentic-commerce-skills-plugins

Test WooCommerce extensions — PHPUnit unit/integration tests, WP test suite, WooCommerce test helpers, E2E with Playwright, and WP-CLI test scaffolding. Use when writing tests for WooCommerce plugins or setting up a test environment.

woo-setup

17
from OrcaQubits/agentic-commerce-skills-plugins

Install WooCommerce, configure the development stack, and set up a local dev environment with WP-CLI, Docker, or wp-env. Use when setting up a new WooCommerce project or development environment.

woo-security

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement WooCommerce security — nonces, capabilities, input sanitization, output escaping, data validation, PCI compliance considerations, and WordPress security best practices. Use when hardening a WooCommerce store or reviewing security posture.

woo-plugin-dev

17
from OrcaQubits/agentic-commerce-skills-plugins

Create WooCommerce extensions/plugins — file structure, main plugin file, activation/deactivation hooks, custom database tables, autoloading, and WordPress plugin API. Use when building new WooCommerce extensions or structuring plugin code.

woo-performance

17
from OrcaQubits/agentic-commerce-skills-plugins

Optimize WooCommerce performance — object caching, transients, HPOS, database optimization, Action Scheduler, lazy loading, and query optimization. Use when improving store performance or diagnosing slowness.

woo-payments

17
from OrcaQubits/agentic-commerce-skills-plugins

Build WooCommerce payment gateways — WC_Payment_Gateway, direct/redirect/hosted integrations, tokenization, subscriptions support, refunds, and PCI compliance. Use when creating custom payment method integrations.

woo-hooks-filters

17
from OrcaQubits/agentic-commerce-skills-plugins

Master the WordPress hook system for WooCommerce — actions, filters, hook priorities, WooCommerce-specific hooks, and extensibility patterns. Use when adding functionality via hooks or understanding the WooCommerce execution flow.

woo-frontend

17
from OrcaQubits/agentic-commerce-skills-plugins

Customize WooCommerce frontend — template overrides, theme integration, shortcodes, hooks for product/cart/checkout display, and WooCommerce block themes. Use when modifying the storefront appearance or building WooCommerce themes.

woo-deploy

17
from OrcaQubits/agentic-commerce-skills-plugins

Deploy WooCommerce — WP-CLI automation, database migrations, zero-downtime updates, staging workflows, environment configuration, and CI/CD patterns. Use when deploying WooCommerce stores or setting up deployment pipelines.

woo-data-stores

17
from OrcaQubits/agentic-commerce-skills-plugins

Work with WooCommerce CRUD data stores — WC_Product, WC_Order, WC_Customer, WC_Coupon data objects, custom data stores, HPOS migration, and getters/setters. Use when creating or modifying WooCommerce data objects or implementing custom data stores.