| name | WooCommerce Integration |
| description | Expert knowledge in WooCommerce development, hooks, filters, custom functionality, product types, and REST API integration. ALWAYS verify with Context7 for up-to-date WooCommerce 8.5+ documentation. Triggers on keywords like "woocommerce", "product", "cart", "checkout", "wc_", "shop", "orders". |
| version | 1.0.0 |
WooCommerce Integration
Build custom WooCommerce functionality with hooks, filters, REST API, and SkyyRose luxury e-commerce features.
CRITICAL: Always use Context7 to verify current WooCommerce 8.5+ documentation before implementing.
When to Use This Skill
Activate when working on:
- WooCommerce product customization
- Custom checkout flows
- Cart modifications
- Order management
- Product types (simple, variable, grouped)
- WooCommerce hooks and filters
- REST API integration
- Payment gateway customization
WooCommerce Structure
Core Files
wp-content/plugins/woocommerce/
├── includes/
│ ├── wc-template-functions.php # Template functions
│ ├── wc-product-functions.php # Product utilities
│ └── class-wc-product.php # Product class
│
└── templates/ # Template files
├── single-product.php
├── archive-product.php
├── cart/
└── checkout/
Theme Overrides
skyyrose-2025/
└── woocommerce/ # WooCommerce template overrides
├── single-product.php # Product page
├── archive-product.php # Shop page
├── cart/
│ ├── cart.php
│ └── mini-cart.php
├── checkout/
│ ├── form-checkout.php
│ └── thankyou.php
└── content-product.php # Product loop item
Context7 Verification Required
Before implementing ANY WooCommerce code:
resolve-library-id --query="WooCommerce hooks and filters" --library-name="woocommerce"
query-docs --library-id="/woocommerce/woocommerce" --query="custom product fields"
Never use deprecated hooks - Context7 ensures you use current APIs.
Product Customization
Add Custom Product Fields
<?php
add_action('woocommerce_product_options_general_product_data', 'skyyrose_add_custom_product_fields');
function skyyrose_add_custom_product_fields() {
global $product_object;
echo '<div class="options_group">';
woocommerce_wp_select([
'id' => '_skyyrose_collection',
'label' => __('Collection', 'skyyrose'),
'options' => [
'' => __('Select collection...', 'skyyrose'),
'signature' => __('Signature Collection', 'skyyrose'),
'black_rose' => __('Black Rose Collection', 'skyyrose'),
'love_hurts' => __('Love Hurts Collection', 'skyyrose'),
],
'value' => $product_object ? $product_object->get_meta('_skyyrose_collection') : '',
]);
([
=> ,
=> (, ),
=> ,
=> ,
=> (, ),
=> ? ->() : ,
]);
([
=> ,
=> (, ),
=> ,
=> ? ->() : ,
]);
([
=> ,
=> (, ),
=> ,
=> [
=> ,
=> ,
],
=> ? ->() : ,
]);
;
}
(, );
{
(([])) {
->(, ([]));
}
(([])) {
->(, ([]));
}
(([])) {
->(, ([]));
}
(([])) {
->(, ([]));
}
}
Display Custom Fields on Product Page
<?php
add_action('woocommerce_single_product_summary', 'skyyrose_display_product_meta', 25);
function skyyrose_display_product_meta() {
global $product;
$collection = $product->get_meta('_skyyrose_collection');
$materials = $product->get_meta('_materials_description');
$hours = $product->get_meta('_craftsmanship_hours');
if (!$collection && !$materials && !$hours) {
return;
}
echo '<div class="skyyrose-product-meta">';
if ($collection) {
$collection_names = [
'signature' => __('Signature Collection', 'skyyrose'),
'black_rose' => __('Black Rose Collection', 'skyyrose'),
'love_hurts' => __('Love Hurts Collection', 'skyyrose'),
];
?>
<div {
<div {
<div
Custom Product Types
Pre-Order Product Type
<?php
add_filter('product_type_selector', 'skyyrose_add_preorder_product_type');
function skyyrose_add_preorder_product_type($types) {
$types['preorder'] = __('Pre-Order', 'skyyrose');
return $types;
}
class WC_Product_PreOrder extends WC_Product {
public function __construct($product = 0) {
$this->product_type = 'preorder';
parent::__construct($product);
}
public function get_type() {
return 'preorder';
}
public function is_purchasable() {
return true;
}
public function is_sold_individually() {
return ;
}
{
->();
}
{
->(, );
}
}
Checkout Customization
Add Custom Checkout Field
<?php
add_action('woocommerce_after_order_notes', 'skyyrose_add_gift_message_field');
function skyyrose_add_gift_message_field($checkout) {
echo '<div class="skyyrose-gift-options">';
woocommerce_form_field('gift_message', [
'type' => 'textarea',
'class' => ['gift-message-field'],
'label' => __('Gift Message (Optional)', 'skyyrose'),
'placeholder' => __('Your heartfelt message...', 'skyyrose'),
'maxlength' => 250,
'rows' => 4,
], $checkout->get_value('gift_message'));
woocommerce_form_field('gift_wrap', [
'type' => 'checkbox',
'class' => ['gift-wrap-checkbox'],
'label' => __('Premium Gift Wrapping (+$25)', 'skyyrose'),
], $checkout->get_value('gift_wrap'));
echo ;
}
(, );
{
(!([])) {
(, , ([]));
}
(!([])) {
(, , );
= ();
= ();
->((, ));
->();
->();
->();
->();
}
}
(, );
{
= ->();
= ->();
( || ) {
;
. (, ) . ;
() {
. (, ) . ;
}
() {
. (, ) . ;
. () . ;
}
;
}
}
Cart Modifications
Add Collection Badge to Cart Items
<?php
add_filter('woocommerce_cart_item_name', 'skyyrose_add_collection_badge_to_cart', 10, 3);
function skyyrose_add_collection_badge_to_cart($product_name, $cart_item, $cart_item_key) {
$product = $cart_item['data'];
$collection = $product->get_meta('_skyyrose_collection');
if ($collection) {
$collection_names = [
'signature' => 'Signature',
'black_rose' => 'Black Rose',
'love_hurts' => 'Love Hurts',
];
$badge = sprintf(
'<span class="collection-badge collection-%s">%s</span>',
esc_attr($collection),
esc_html($collection_names[$collection] ?? $collection)
);
$product_name = $badge . ' ' . $product_name;
}
return $product_name;
}
WooCommerce Hooks Reference
Product Hooks
do_action('woocommerce_before_single_product');
do_action('woocommerce_product_thumbnails');
do_action('woocommerce_single_product_summary');
do_action('woocommerce_after_single_product');
Shop/Archive Hooks
do_action('woocommerce_before_shop_loop');
do_action('woocommerce_before_shop_loop_item');
do_action('woocommerce_before_shop_loop_item_title');
do_action('woocommerce_shop_loop_item_title');
do_action('woocommerce_after_shop_loop_item_title');
do_action('woocommerce_after_shop_loop_item');
do_action('woocommerce_after_shop_loop');
Cart Hooks
do_action('woocommerce_before_cart');
do_action('woocommerce_before_cart_table');
do_action('woocommerce_before_cart_contents');
do_action('woocommerce_cart_contents');
do_action('woocommerce_after_cart_contents');
do_action('woocommerce_after_cart_table');
do_action('woocommerce_cart_collaterals');
do_action('woocommerce_after_cart');
Checkout Hooks
do_action('woocommerce_before_checkout_form', $checkout);
do_action('woocommerce_checkout_before_customer_details');
do_action('woocommerce_checkout_billing');
do_action('woocommerce_checkout_shipping');
do_action('woocommerce_checkout_after_customer_details');
do_action('woocommerce_checkout_before_order_review');
do_action('woocommerce_checkout_order_review');
do_action('woocommerce_checkout_after_order_review');
do_action('woocommerce_after_checkout_form', $checkout);
WooCommerce REST API
Create Product via API
<?php
function skyyrose_create_product_via_api($product_data) {
$consumer_key = get_option('woocommerce_consumer_key');
$consumer_secret = get_option('woocommerce_consumer_secret');
$auth = base64_encode("{$consumer_key}:{$consumer_secret}");
$response = wp_remote_post(rest_url('/wc/v3/products'), [
'headers' => [
'Authorization' => "Basic {$auth}",
'Content-Type' => 'application/json',
],
'body' => wp_json_encode([
'name' => $product_data['name'],
'type' => 'simple',
'regular_price' => $product_data['price'],
'description' => $product_data['description'],
'short_description' => $product_data['short_description'],
'categories' => $product_data[],
=> [],
=> [
[
=> ,
=> [],
],
[
=> ,
=> [],
],
],
]),
]);
(()) {
;
}
((), );
}
SkyyRose-Specific Patterns
Luxury Price Display
<?php
add_filter('woocommerce_get_price_html', 'skyyrose_custom_price_display', 10, 2);
function skyyrose_custom_price_display($price, $product) {
if ($product->is_on_sale()) {
return sprintf(
'<div class="luxury-price sale">
<span class="original-price">%s</span>
<span class="sale-price">%s</span>
</div>',
wc_format_sale_price($product->get_regular_price(), $product->get_sale_price()),
''
);
}
return sprintf(
'<div class="luxury-price">
<span class="price-amount">%s</span>
</div>',
$price
);
}
References
See references/ for:
woocommerce-hooks-complete.md - All WooCommerce hooks
rest-api-reference.md - REST API endpoints
custom-product-types.md - Creating custom product types
checkout-optimization.md - Luxury checkout patterns
Examples
See examples/ for:
custom-product-fields.php - Complete custom fields implementation
pre-order-product-type.php - Pre-order product type
luxury-checkout.php - Custom checkout with gift options
collection-filtering.php - Collection-based product filtering