php - Creating hooks on woocommerce, finding hook_names -
i working on website using woocommerce rather have shopping facility i'm trying change wording, whilst keeping functionality able add products shopping cart calling enquiry, , call quote in replace prices.
i have set prices when 0 entered won't display standard 'free!' , instead states 'call quote' adding functions.php
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' ); // 2.1 + function woo_custom_cart_button_text() { return __( 'add enquiry', 'woocommerce' ); } this works fine, , sourced particular hook online obtain code, starting further project wanting edit more button texts.
my question is, how know obtain hook names can start create own hooks this, can seen class names when inspecting on google devtools? dragging woocommerce folder on sublime text 2 , conducting search woocommerce_product_single_add_to_cart_text can returned reults able see hook, how come across hook name begin with? have looked @ http://docs.woothemes.com/wc-apidocs/hook-docs.html couldn't see names in relation above hook begin trying decipher how or obtained.
how know obtain hook names can start create own hooks this, can seen class names when inspecting on google devtools?
no.
to find particular hook, you'd need @ code base. in repositories organised such woocommerce, should have rough idea particular hook.
for example, if wanted hook in thankyou page first try looking in templates > checkout > thankyou.php. there find woocommerce_thankyou action hook let me insert custom functionality.
alternatively, there's woocommerce hook documentation.
Comments
Post a Comment