content-product.php
action hooks
name detail woocommerce_before_shop_loop_item Add an action at the top of the product list woocommerce_before_shop_loop_item_title Add an action at the top of the product name woocommerce_shop_loop_item_title Add an action at the bottom of the product name woocommerce_after_shop_loop_item_title Add an action at the bottom of the product list
The positions of the action hooks that can be added to the product list screen are as follows.
single-product.php
action hooks
name detail woocommerce_before_single_product Add action to the top of the product details screen woocommerce_before_single_product_summary N/A woocommerce_single_product_summary Product detail description Add action to the top woocommerce_after_single_product_summary Product details Add action to the bottom
The positions of the action hooks that can be used are as follows.
Action hook to product details Screen image
navigation.php
action hooks
name detail woocommerce_before_account_navigation Add action to the top of the MyAccount menu screen woocommerce_after_account_navigation Add action to the bottom of the MyAccount menu screen
cart.php
action hooks
name detail woocommerce_before_cart Add action to the top of the cart screen woocommerce_before_cart_table Add action to the top of the cart table woocommerce_before_cart_contents Add action to the top of the cart content woocommerce_after_cart_item_name Add action to product name in cart woocommerce_cart_contents Add actions to cart content woocommerce_cart_coupon Add action to the coupon display part woocommerce_cart_actions Add action to action button in cart woocommerce_after_cart_contents Add action to the bottom of the cart content woocommerce_after_cart_table Add action to the bottom of the cart table woocommerce_before_cart_collaterals Add action to the top of the collaterals woocommerce_cart_collaterals Add action to the bottom of the collaterals woocommerce_after_cart Add action to the bottomof the cart screen
filter hooks
name detail woocommerce_cart_item_product Get a set of product information You can get an object with properties such as name woocommerce_cart_item_product_id Product ID can be obtained woocommerce_cart_item_permalink Product links can be obtained woocommerce_cart_item_thumbnail Product thumbnail images can be obtained woocommerce_cart_item_name Product name can be obtained woocommerce_cart_item_backorder_notification Product backorder notification content can be obtained woocommerce_cart_item_price You can get the product price woocommerce_cart_item_quantity You can get the quantity of products woocommerce_cart_item_subtotal You can get the subtotal of products
cart-totals.php
action hooks
name detail woocommerce_before_cart_totals Add action to the top of the cart total woocommerce_cart_totals_before_shipping Add action to the top of the total shipping cost of the cart woocommerce_cart_totals_after_shipping Add action to the bottom of the total shipping cost of the cart woocommerce_cart_totals_before_order_total Add action to the top of the total column woocommerce_cart_totals_after_order_total Add action to the bottom of the total column woocommerce_proceed_to_checkout Buy button woocommerce_after_cart_totals Add action to the bottom of the cart total
payment-methods.php
action hooks
name detail woocommerce_before_account_payment_methods Add action to the top of the payment screen of My Account woocommerce_account_payment_methods_column_method,$method Add action to the payment method column of My Account woocommerce_account_payment_methods_column_expires,$method Add action to the expiration date column of My Account woocommerce_account_payment_methods_column_actions,$method Add action to the action column of My Account woocommerce_after_account_payment_methods Add action to the bottom of the payment screen of My Account
Payment method action hook screen image
Since it is difficult to use the function to hand over the parlor meter, we will present a sample easily.
function my_woocommerce_account_payment_methods_column_expires($method){
echo '<b>!!!!expires!!!!</b><br>';
echo $method['expires'];
}
add_filter('woocommerce_account_payment_methods_column_expires','my_woocommerce_account_payment_methods_column_expires');
woocommerce_account_payment_methods_column_expires
function my_woocommerce_account_payment_methods_column_actions($method){
echo '<b>!!!!actions!!!!</b><br>';
echo $method['actions'];
}
add_filter('woocommerce_account_payment_methods_column_actions','my_woocommerce_account_payment_methods_column_actions');
function my_woocommerce_after_account_payment_methods(){
echo '<b>!!!!woocommerce_after_account_payment_methods!!!!</b>';
}
add_filter('woocommerce_after_account_payment_methods','my_woocommerce_after_account_payment_methods');
shipping-calculator.php
action hooks
name detail woocommerce_before_shipping_calculator Add action to the top of the shipping calculation field woocommerce_after_shipping_calculator Add action to the bottom of the shipping calculation field
filter hooks
name detail woocommerce_shipping_calculator_enable_country Do you want to enable shipping calculation in country settings? woocommerce_shipping_calculator_enable_state Whether to enable shipping calculation in the state setting woocommerce_shipping_calculator_enable_city Do you want to enable shipping calculation in city settings? woocommerce_shipping_calculator_enable_postcode Whether to enable shipping calculation in postcode settings
form-checkout.php
action hooks
name detail woocommerce_before_checkout_form Add action to the top of the checkout form woocommerce_checkout_before_customer_details Add action to the top of customer information woocommerce_checkout_billing Add action to billing field woocommerce_checkout_shipping Add action to shipping address field woocommerce_checkout_after_customer_details Add action at the bottom of customer information woocommerce_checkout_before_order_review_heading Add action to order confirmation header woocommerce_checkout_before_order_review Add action to the top of order confirmation woocommerce_checkout_order_review Add action to order confirmation column woocommerce_checkout_after_order_review Add action to the bottom of order confirmation woocommerce_after_checkout_form Add action to the bottom of the checkout form
filter hooks
name detail woocommerce_checkout_must_be_logged_in_message Get login guidance message
form-login.php
action hooks
name detail woocommerce_login_form_start Add action at the top of the login form woocommerce_login_form Add action to login field woocommerce_login_form_end Add action at the bottom of the login form
order-details.php
action hooks
name detail woocommerce_order_details_before_order_table Add action to the top of MyAccount order details woocommerce_order_details_before_order_table_items Add action to the top of the order details woocommerce_order_details_after_order_table_items Add action to order details woocommerce_order_details_after_order_table Add action at the bottom of the order details woocommerce_after_order_details Add action to the bottom of MyAccount order details
filter hooks
name detail woocommerce_purchase_order_item_types Get the type of order details woocommerce_purchase_note_order_statuses Get the status of the order details
The following information is output for each.
function my_woocommerce_purchase_order_item_types($data){
var_dump($data);
}
add_filter('woocommerce_purchase_order_item_types','my_woocommerce_purchase_order_item_types');
//string(9) "line_item"
function my_woocommerce_purchase_note_order_statuses($data){
var_dump($data);
}
add_filter('woocommerce_purchase_note_order_statuses','my_woocommerce_purchase_note_order_statuses');
//array(2) { [0]=> string(9) "completed" [1]=> string(10) "processing" }
class-wc-emails.php
action hooks
name detail woocommerce_email_header Add action to email header woocommerce_email_footer Add action to mail footer woocommerce_email_order_details Add action to email body order details woocommerce_email_order_meta Add action to email body order attribute woocommerce_email_customer_details Email body Add action to customer details woocommerce_low_stock_notification Addition of action at the time of notification of low inventory email woocommerce_no_stock_notification Added action when notifying no-stock email woocommerce_product_on_backorder_notification Added action when notifying backorder woocommerce_created_customer_notification Add action to customer notification email woocommerce_email_footer_text Add action to the site title field of mail footer woocommerce_email Add action when sending an email
filter hooks
name detail woocommerce_email_headers Get email headers woocommerce_email_order_meta_fields Get email order meta woocommerce_email_order_meta_keys Get email order key woocommerce_email_customer_details_fields Get email customer details woocommerce_email_subject_low_stock Get email order key woocommerce_email_content_low_stock Get email low stock content woocommerce_email_attachments Get email attachements woocommerce_email_subject_backorder Get email subject of backorder woocommerce_email_content_backorder Get email content of backorder woocommerce_email_subject_no_stock Get email subject of no-stock woocommerce_email_content_no_stock Get email content of no-stock
Summary
We have introduced a list of hooks and filter hooks.
I think this information will be useful for adding functions.
There are other action hooks and filter hooks available, so if you want to find something other than the ones introduced this time, please see the official website.
WooCommerceのアクションフック・フィルターフック一覧