woocommerce_product_single_add_to_cart_text
Get the add to cart button text for the single page.
Использование
add_filter( 'woocommerce_product_single_add_to_cart_text', 'wp_kama_woocommerce_product_single_add_to_cart_text_filter', 10, 2 );
/**
* Function for `woocommerce_product_single_add_to_cart_text` filter-hook.
*
* @param $this->get_button_text()
* @param $that
*
* @return
*/
function wp_kama_woocommerce_product_single_add_to_cart_text_filter( $this->get_button_text(), $that ){
// filter...
return $this->get_button_text();
}
- $this->get_button_text()
- -
- $that
- -
Где вызывается хук
woocommerce_product_single_add_to_cart_text
woocommerce_product_single_add_to_cart_text
woocommerce/includes/class-wc-product-external.php 174
return apply_filters( 'woocommerce_product_single_add_to_cart_text', $this->get_button_text() ? $this->get_button_text() : _x( 'Buy product', 'placeholder', 'woocommerce' ), $this );
woocommerce/includes/abstracts/abstract-wc-product.php 2094
return apply_filters( 'woocommerce_product_single_add_to_cart_text', __( 'Add to cart', 'woocommerce' ), $this );