ืื ืื ืคืขื ื ืืกืืชื ืืฉื ืืฆ ืขืืื ืื ืชืื ืืช ืืื ืืช WooCommerce, ืื ืจืื ืืืื ืชื ืฉืืืืง ืืงืฉื ืืืืชืจ ืืื ืืืืงื ืืืฆืื ืืช ืืืืง ืื ืืื. ื-WooCommerce ืืฉ ืืืขืื ื-2,500 ืืืงืื (ืื, ืงืจืืชื ื ืืื), ืืืงืื ืืกืื action ื-filter ืืคืืืจืื ืืื templates, classes ื-APIs ืฉืื ืื.
ืืืคื ืืืื ืืจืืงืืืืืช ืฉืืืขืื ื ืืขืื ืืืืืง ืืฉืืื ืื: ืืื ืืฆืืื ืืืืคื ืืืืืืื ืื ืืืง ืฉื template, ืขืืืจ ืื ืืื ืืขืืืื WooCommerce.
ืืื ืืืงืื ื-WooCommerce
ืืืงืื ืื ื ืงืืืืช ืืืืืจืืช ืืจืืฉ ืืงืื ืฉื WooCommerce, ืฉืืื ืชืืืื ืืืืจืืง ืคืื ืงืฆืืื ืืืืช ืืฉืืื. ืงืืืืื ืฉื ื ืกืืืื:
- ืืืงืื ืืกืื action ืืืคืฉืจืื ืืื ืืืืกืืฃ ืชืืื ืื ืืืจืืฅ ืงืื ืื ืงืืื ืืกืืืืช. WooCommerce ืงืืจื ื-
do_action(), ืืืคืื ืงืฆืื ืฉืืื ืจืฆื. - ืืืงืื ืืกืื filter ืืืคืฉืจืื ืืื ืืฉื ืืช ืืืืข ืืคื ื ืฉ-WooCommerce ืืฉืชืืฉ ืื. WooCommerce ืืขืืืจ ืืช ืืืชื ืืืืข ืืจื
apply_filters(), ืืืคืื ืงืฆืื ืฉืืื ืืฉื ื ืืืชื ืืืืืืจื ืืช ืืชืืฆืื.
ืื ืืชื ืจืง ืืชืืืืื ืขื ืืืงืื ืฉื WooCommerce, ืื ื ืืืืืฅ ืืคืชืื ืขื ืืืืจืื ืืืื ืฉืื ืืืืงืื ืฉื WooCommerce ืืืืืจืืช ืืขืืืงื ืืืชืจ. ืืชืืืืจ ืขืฆืื ืื ืคืฉืื, ืืืงืื ืืื ืืกืืืจ ืืืช ืืื ืืื ื (ืืืืื):
// Action: add content after the product price
add_action( 'woocommerce_single_product_summary', 'my_custom_content', 15 );
function my_custom_content() {
echo '<p>Custom content here</p>';
}
// Filter: modify the product tabs array
add_filter( 'woocommerce_product_tabs', 'my_custom_tabs' );
function my_custom_tabs( $tabs ) {
unset( $tabs['reviews'] );
return $tabs;
}
ืืคืจืืืจ ืืฉืืืฉื ื-add_action() ืืื ื-priority (ืืขืืืคืืช). ืืกืคืจืื ื ืืืืื ืจืฆืื ืจืืฉืื ืื. WooCommerce ืืฉืชืืฉ ืืงืคืืฆืืช ืฉื 5 ืื 10 ืขืืืจ ื-callbacks ืืืืื ืื ืฉืื, ืื ืฉื ืฉืืจ ืืงืื ืืงืื ืฉืืื ืืืฉืชืื ืืื ืืื.
ืืืฆื ืืืฆืื ืืืงืื ื-WooCommerce
ืืคื ืืื ืฉืืืฉ ืฉืืืืช ืืขืฉืืืช ืืืืืื ืืืงืื ืืื ืขืืื ืฉื WooCommerce:
1. ืืงืืืฅ wc-template-hooks.php
ืงืืืฅ ืืืื ืื, ืื ืืฆื ืืชืืงืืืช includes/ ืฉื WooCommerce, ืจืืฉื ืืช ืื 73 ื-callbacks ืฉื ืืืงืื ืืกืื template. ืื ืืงืืจ ืืืืช (source of truth) ืืืื ืื ืฉ-WooCommerce ืืืืจ ืืืจืืจืช ืืืื ืืื ืืืง, ืืืืืื priority.
wp-content/plugins/woocommerce/includes/wc-template-hooks.php
ืคืชืื ืืืชื ืืืคืฉื ืืช ืืืืง ืฉืืชื ืฆืจืืืื. ืื ืงืจืืื ื-add_action() ืื-add_filter() ืืจืื ืืื ืืืืืง ืื WooCommerce ืขืืฉื ืขื ืื ืืืง.
2. ืืชืืกืฃ Query Monitor
ืืชืงืื ื ืืช Query Monitor ืืืืฉื ืืขืืื ืืืฉืื ืฉื WooCommerce. ืืคืื ื ืดHooks and Actionsืด ืืฆืื ืื ืืืง ืฉื ืืจื ืืืืื ืืขืื ืช ืืืชื ืขืืื, ืืคื ืกืืจ ืืืจืฆื, ืืื ืขื ื-callbacks ืืืืืืจืื ืืืื ืื-priorities ืฉืืื (ืืื).
3. ืืืคื ืืืื ืืจืืงืืืืืช ืฉืืืขืื
ืืช ืืืคื ืืืืืืืืืืช ืฉืืจืืฉ ืืขืืื ืื ืืชื ืืืืืง ืืืื ืืคืชืืจ ืืช ืืืชื ืืขืื. ืื template ืฉื ืขืืื WooCommerce ืืืืฆื ื-wireframe, ืืฉืืืืงืื ืืืืงืืื ืืืืืง ืืืงืื ืื ืื ื ืืจืื ืืชืืืื ืืจืื ืืืจ (ืืขืืืื).
ืกืืจ ืืืจืฆื ืฉื ืืืืงืื ืื-Priorities
ืื ืืืง ื-WooCommerce ื ืืจื ื-priority ืกืคืฆืืคื. ื-callbacks ืืืืื ืื ืฉื WooCommerce ืืฉืชืืฉืื ืืืจื ืืื ื-priorities 5, 10, 20, 30, 40 ื-50. ืืงืื ืืืืชืื ืืืฉืืช ืฉืืื ืืฉืชืื ืืื ืืื, ืืืชืื ื-priority ืฉืชืืืืจื.
ื ืืงื ืืช ืขืืื ืืืืฆืจ ืืืืื (single product) ืืืืืื. ืืืืง woocommerce_single_product_summary ืืื ืืขืื container ืฉืืืื WooCommerce ืืืืจ ืืกืคืจ callbacks ื-priorities ืฉืื ืื:
| Priority | Callback | ืคืื |
|---|---|---|
| 5 | woocommerce_template_single_title |
ืืืชืจืช ืืืืฆืจ |
| 10 | woocommerce_template_single_rating |
ืืืจืื ืืืืืื |
| 10 | woocommerce_template_single_price |
ืืืืจ |
| 20 | woocommerce_template_single_excerpt |
ืชืืืืจ ืงืฆืจ |
| 30 | woocommerce_template_single_add_to_cart |
ืืคืชืืจ ืืืกืคื ืืขืืื |
| 40 | woocommerce_template_single_meta |
ืืงืดื, ืงืืืืจืืืช, ืชืืืืช |
| 50 | woocommerce_template_single_sharing |
ืืคืชืืจื ืฉืืชืืฃ ืืืจืชื |
ืืืื ืืืืกืืฃ ืชืืื ืืืชืื ืืืฉืืช ืืื ืืืืืจ ืืชืืืืจ ืืงืฆืจ, ืืฉืชืืฉื ื-priority 15:
add_action( 'woocommerce_single_product_summary', 'my_custom_text_after_price', 15 );
function my_custom_text_after_price() {
echo '<p class="custom-notice">Free shipping on orders over $50</p>';
}
ืืืื ืืืกืืจ ืืืื ื ืฉืืืืข ืืืจืืจืช ืืืื, ืืฉืชืืฉื ื-remove_action() ืขื ืืืชื ืฉื ืคืื ืงืฆืื ืืืืชื priority ืืืืืง:
// Remove the product meta (SKU, categories, tags)
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
remove_action() ืื ื-remove_filter() ืขื ืืืชื priority ืืืืืงืช ืฉืื ืืฉืชืืฉ WooCommerce ืืขืช ืืืืืจ ื-callback. ืื ื-priority ืืื ื ืชืืืืช, ืืืกืจื ืคืฉืื ืชืืืฉื ืืฉืงื, ืืื ืืืืขืช ืฉืืืื.ืืืงืื ืฉื WooCommerce ืืชืฉืืื ืืืืกืก ืืืืงืื (Block Checkout)
WooCommerce ืืขืืืจ ืืืืจืื ืืช ืขืืืื ืืขืืื ืืืชืฉืืื ืฉืื ืืืจืืืืงืืืจื ืืืืกืกืช ืืืืงืื (blocks). ืืืื ืื ืืืฆืจ ืฉืชื ืืขืจืืืช ืืงืืืืืช ืฉืื ืืคืชื ืฆืจืื ืืืืืจ.
ืืืืืืฅ [ืฉื ื-Block Checkout] ื ืืื ืืืฆืคืื – ืฆืืืช WooCommerce, ืืคืจืื 2025
ื ืืื ืืชืืืืช 2026, ื-87% ืืื ืืืืช WooCommerce ืขืืืื ืืฉืชืืฉืืช ืืขืืื ืืชืฉืืื ืืงืืืกื, ืืืืืกืก ืขื shortcode. ืจืง 35 ืืืงืื ืงืืืกืืื ืืืขืืจื ืจืฉืืืช ืืขืืื ืขื ื-Block Checkout: 24 ืืกืื filter ื-11 ืืกืื action.
ืืืงืื ืงืืืกืืื ืฉื PHP ืคืฉืื ืืื ื ื ืืจืื ืืฉื-checkout ืืืืกืก ืืืืืงืื ืขืืื. WooCommerce ืืฆืืข ืฉืืืฉื ืืกืืืืื ืืืชืืื ืืืฉืืช ืฉื ืืืจืกื ืืืืกืกืช ืืืืืงืื (ืืฉืื ืื):
- ืืืงืื ืฉืืืขืืจื – 35 ืืืงืื ืฉืขืืืืื ืื ืืืงืฉืจ ืืงืืืกื ืืื ืืืืืงืื, ืืื ืืืงืื ืืืืฉืื ืืฉืืื ืืืก ืืืืงืื ืฉื ืืคืกื ืืืืื ืืืืฉืืื.
- Checkout Extensibility API – filters ืืืืกืกื JavaScript ืืจืืืื Slot/Fill ืขืืืจ ื-Block Checkout. ืืืจืฉ ืืืข ื-webpack ืื-React.
- Additional Checkout Fields API – ืืืฆื ื-WooCommerce 8.6 ืืืขืื, ืืืืืืฃ ืืช ื-filter
woocommerce_checkout_fieldsืืืืกืคืช ืฉืืืช ืืืชืืืื ื-Block Checkout.
ืืฉืื ืื, ืื ื ืืืืืฅ ืืืืื ืืืืงืื ืืงืืืกืืื ืืจืื ืืคืจืืืงืืื. ืืฉืืืืืฅ ื-Block Checkout ืืืื, ืื ื ืืืืื ืืขืืื ืืช ืืืจืื ืื ืขื ืืฉืื ืืช ืืืขืืืืช ืืืืงืื ืฉื ืืืืงืื.
ืืฉืืืืช ื ืคืืฆืืช – ืืืืื ืืืง ืืืฉืชืืฉ
ืืืงืื ืืืคืฉ ืืื ืฉืืืช ืืืืงืื, ืืฆืื ืืช ืืืฉืืื ืฉืืชื ืฆืจืืืื ืืืฉืชืืฉื ืืืืง ืืืืืืฅ:
| ืื ื ืจืืฆื ื… | Hook | ืกืื |
|---|---|---|
| ืืืืกืืฃ ืชืืื ืืขื ืืืืฆืจ | woocommerce_before_single_product |
action |
| ืืืืื ืื ืืืกืืจ ืืช ืืืืจ ืืืืฆืจ | woocommerce_single_product_summary |
action (priority 10) |
| ืืืืกืืฃ ืืฉืื ืืช ืืืฆืจ ืืืชืืืช | woocommerce_product_tabs |
filter |
| ืืฉื ืืช ืืช ืืืงืกื ืฉื ืืคืชืืจ ืืืืกืคื ืืขืืื | woocommerce_product_single_add_to_cart_text |
filter |
| ืืืืกืืฃ ืฉืื ืืืชืื ืืขืืื ืืชืฉืืื | woocommerce_checkout_fields |
filter |
| ืืืืกืืฃ ืชืืื ืืคื ื ืืคืชืืจ ืืืฆืืข ืืืืื ื | woocommerce_review_order_before_submit |
action |
| ืืืืกืืฃ ืขืืื ืืขืืื | woocommerce_cart_calculate_fees |
action |
| ืืฉื ืืช ืืช ืชืฆืืืช ืกืืืืื ืืขืืื | woocommerce_cart_totals_before_order_total |
action |
| ืืืืกืืฃ ืืฉืื ืืช ืืืชืืืช ืืดืืืฉืืื ืฉืืืด | woocommerce_account_menu_items |
filter |
| ืืืจืืฅ ืงืื ืืืืจ ืืืฆืืข ืืืื ื | woocommerce_thankyou |
action |
| ืืฉื ืืช ืืช ืชืฆืืืช ืืืืจ ืืืืฆืจ | woocommerce_get_price_html |
filter |
| ืืืืกืืฃ ืชืืื ื-shop loop | woocommerce_after_shop_loop_item_title |
action |
| ืืืกืืจ ืืขืื ืช CSS/JS ืฉื WooCommerce ืืขืืืืื ืฉืืื ื ืฉื ืืื ืืช | wp_enqueue_scripts |
action |
| ืืืืกืืฃ ืฉืืืช ืืืชืืืื ืืืืฆืจืื | woocommerce_product_options_general_product_data |
action |
| ืืื ืืข ืืขืื ืช ื ืืกืื (assets) ืฉื WooCommerce | wp_enqueue_scripts |
action |
ืฉืืืืช ื ืคืืฆืืช
ืฉืืืืช ื ืคืืฆืืช ืืืื ืืืงืื ื-WooCommerce:
wc-template-hooks.php ืืืื ืจืฉืืืื 73 callbacks ืฉื ืืืงื template - 67 ืืกืื action ื-6 ืืกืื filter.add_action() ืื-filters ืืฉืชืืฉืื ื-add_filter(). ืืืืื ืืืจืืื: filters ืืืืืื ืืืืืืจ ืขืจื, ืืืืื actions ืื (ืืืืื).wc-template-hooks.php ืืชืืงืืืช ืืชืืกืฃ ืฉื WooCommerce ืืืื ืืจืืืช ืืช ืื ืจืืฉืืื ืืืืงืื ืืืืื ืื ืืืช ื-priorities ืฉืืื.add_action() ืื ื-add_filter(). ืืกืคืจืื ื ืืืืื ืจืฆืื ืจืืฉืื ืื. WooCommerce ืืฉืชืืฉ ืืงืคืืฆืืช ืฉื 5 ืื 10 ืขืืืจ ืืจืืจืืช ืืืืื ืฉืื, ืืืฉื ืืืชืจืช ื-5, ืืืืจ ื-10 ืืืืกืคื ืืขืืื ื-30. ืืืื ืืืงื ืืช ืืงืื ืฉืืื ืืื ืฉืชื ืืจืืจืืช ืืืื, ืืืจื ืขืจื priority ืฉื ืืฆื ืืื ืืื.functions.php ืฉื ืชืื ืืช ืืืช (child theme). ืืื ืืืจ ืฉืืขืืจ ืืืื ืืืงืื, ืฆืจื ืชืืกืฃ ืืืขืืื ืืืชืจ (site-specific plugin). ืื ืืืชืืืืช ื ืฉืืจืืช ืขืฆืืืืืช ืืืชืื ืืช. ืืขืืื ืื ืชืขืจืื ืืฉืืจืืช ืืช ืงืืฆื ืืืืื ืฉื WooCommerce.ืืกืืืื
ืืืชืจ ื-2,500 ืืืงืื ืฉื WooCommerce ื ืืชื ืื ืืื ืฉืืืื ืืืื ืืื ืขืืื, ืืื ืจืง ืื ืืชื ืืืืขืื ืืืืื ืืืง ืืืฉืชืืฉ ืืืืื ืืื ื ืืจื. ืืคื ืืืืืืืืช ืื ืืืกื ืืช ืืืฉืช ื-templates ืืืจืืืืื ืฉื WooCommerce: ืืืฆืจ ืืืื, ืืจืืืื ืืื ืืช, ืขืืื, ืชืฉืืื ืืดืืืฉืืื ืฉืืืด. ืื ืืืง ืืืืงื ืืืืืง ืืืงืื ืื ืืื ืจืฅ ืืืืื ืืจืื ืืืจ (ืืฆืืช ืืขืืื), ืืืฉืจ ืืกืื ืฉืื, ื-priority ืื-callbacks ืืืืื ืื ืืืืืื ืืืืืฆื.
ืืฉืชืืฉื ืืืคื ืืืื ืืจืืงืืืืืช ืื ืงืืืช ืืืืืก ืืื ืคืขื ืฉืืชื ืืื ืื ืืชืืืืช ื-WooCommerce. ืืืกืืคื ืขืืื ืื ืืืืขืืคืื – ืืืื ืืฉืืืจ ืืืชื ืืขืืืื ืขื ืืชืคืชืืืช ืืขืจืืช ืืืืงืื ืฉื WooCommerce, ืืืืืืื ืืื ืฉืืืื ืืืืืฅ ืืชืฉืืื ืืืืกืก ืืืืืงืื.
