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/78458762/woocommerce-frequently-bought-together-add-to-cart-button-rename
10 lines
491 B
Text
10 lines
491 B
Text
add_filter( 'woocommerce_product_single_add_to_cart_text', 'filter_product_single_add_to_cart_text', 20, 2 );
|
|
function filter_product_single_add_to_cart_text( $add_to_cart_text, $product ) {
|
|
// Define your targeted product IDs in the array below
|
|
$targeted_ids = array(22246, 22241, 22227, 22039, 22009, 22004, 21999, 21991);
|
|
|
|
if (in_array($product->get_id(), $targeted_ids)) {
|
|
$add_to_cart_text = __("PRE ORDER", "woocommerce");
|
|
}
|
|
return $add_to_cart_text;
|
|
}
|