Woo shipping

From OrcaQubits/agentic-commerce-skills-plugins · View interactive version

Woo shipping is an AI agent skill from the GitHub repository OrcaQubits/agentic-commerce-skills-plugins. 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.

How to use this skill

Skill file

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:

Shipping Classes

Product-level classification for rate customization:

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:

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

Implementation Methods

Required Methods

calculate_shipping()

Receives $package array containing:

Returns rates via $this->add_rate():

$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):

Shipping Packages

What Packages Are

Cart items grouped for shipping calculation:

Package Format

$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:

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):

Tracking

Adding Tracking Data

Store tracking info as order meta:

Free Shipping

Built-in WC_Shipping_Free_Shipping — enable based on:

Best Practices

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

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.