Code-Snippets-Functions/Execute a function on a child site/WooCommerce/price-in-the-add-to-cart-button.txt

4 lines
254 B
Text

add_filter( 'woocommerce_product_add_to_cart_text', 'your_slug_add_to_cart_text', 10, 2 );
function your_slug_add_to_cart_text( $text, $product ) {
return sprintf( '%s - %s', $text, strip_tags( wc_price( wc_get_price_to_display( $product ) ) ) );
}