Skip to content

Add Commerce Abilities to extrachill-shop #2

@chubes4

Description

@chubes4

Summary

Add comprehensive e-commerce abilities to extrachill-shop plugin to support the API delegation wrapper architecture.

Current State

  • extrachill-shop handles WooCommerce integration but has no Abilities API integration
  • Product, order, shipping, and payment operations called directly from API routes
  • No structured ability interface for commerce operations

Required Abilities to Add

  • extrachill/shop-products: Product management and catalog operations
  • extrachill/shop-orders: Order processing and management
  • extrachill/shop-shipping-address: Shipping address management
  • extrachill/shop-shipping-labels: Shipping label generation
  • extrachill/shop-stripe-connect: Stripe Connect integration for artist payouts
  • extrachill/shop-stripe-webhook: Stripe webhook processing
  • extrachill/shop-product-images: Product image management
  • extrachill/shop-taxonomy-counts: Product category/tag statistics

Implementation Details

  • Add ability registration in inc/core/abilities.php (create if doesn't exist)
  • Register extrachill-shop category for commerce-related abilities
  • Each ability should have proper input/output schemas matching WooCommerce expectations
  • Maintain existing WooCommerce integration logic but expose through Abilities API
  • Include permission callbacks with appropriate e-commerce access controls

Example Ability Registration

wp_register_ability(
    'extrachill/shop-products',
    [
        'label' => __('Manage Products', 'extrachill-shop'),
        'description' => __('Create, read, update, and delete WooCommerce products'),
        'category' => 'extrachill-shop',
        'input_schema' => [
            'type' => 'object',
            'properties' => [
                'action' => ['type' => 'string', 'enum' => ['create', 'get', 'update', 'delete']],
                'product_id' => ['type' => 'integer'],
                'product_data' => ['type' => 'object', 'description' => 'WooCommerce product data']
            ],
            'required' => ['action']
        ],
        'output_schema' => [
            'type' => 'object',
            'properties' => [
                'product_id' => ['type' => 'integer'],
                'product' => ['type' => 'object'],
                'success' => ['type' => 'boolean']
            ]
        ],
        'execute_callback' => 'extrachill_shop_ability_products',
        'permission_callback' => 'extrachill_shop_can_manage_products'
    ]
);

Success Criteria

  • All commerce abilities registered and functional
  • Existing WooCommerce functions preserved but exposed through abilities
  • Abilities can be called directly by API plugin for delegation
  • Proper integration with Stripe Connect and webhook processing

Dependencies

  • Requires WordPress 6.9+ with Abilities API support
  • Requires WooCommerce plugin to be active
  • Should maintain backward compatibility with existing direct calls
  • Requires Stripe Connect configuration for payment abilities

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions