mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-05-01 11:52:25 +08:00
https://stackoverflow.com/questions/76055038/display-woocommerce-price-in-the-add-to-cart-button
4 lines
254 B
Text
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 ) ) ) );
|
|
}
|