Last active
May 30, 2020 19:56
-
-
Save Musilda/7d2ca02c7630a5b88117ad065edf2df7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text', 999 ); | |
function woo_custom_cart_button_text( $text ) { | |
foreach( WC()->cart->get_cart() as $cart_item_key => $values ) { | |
$_product = $values['data']; | |
if( get_the_ID() == $_product->get_id() ) { | |
return 'Produkt je již v košíku - přidat znovu?' ; | |
} | |
} | |
return $text; | |
} | |
add_filter( 'woocommerce_product_add_to_cart_text', 'woo_archive_custom_cart_button_text', 999 ); | |
function woo_archive_custom_cart_button_text( $text ) { | |
foreach( WC()->cart->get_cart() as $cart_item_key => $values ) { | |
$_product = $values['data']; | |
if( get_the_ID() == $_product->get_id() ) { | |
return 'Produkt je v košíku'; | |
} | |
} | |
return $text; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment