Skip to content

Instantly share code, notes, and snippets.

@shirokoweb
Last active June 2, 2019 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shirokoweb/7d401445f929b7965ab82b4c63dd1616 to your computer and use it in GitHub Desktop.
Save shirokoweb/7d401445f929b7965ab82b4c63dd1616 to your computer and use it in GitHub Desktop.
Remplacer des chaînes de texte WooCommerce
<?php
// Remplacer "Lire la suite" par autre chose
add_filter( 'woocommerce_product_add_to_cart_text' , 'custom_woocommerce_product_add_to_cart_text' );
function custom_woocommerce_product_add_to_cart_text( $text ) {
// En utilisant une condition (if)
if ( 'Lire la suite' == $text ) {
$text = __( 'Commander', 'woocommerce' );
}
return $text;
}
// Personnaliser "Choisir une option" du menu déroulant WC par "Autre chose"
add_filter('woocommerce_dropdown_variation_attribute_options_args', 'custom_woocommerce_dropdown_variation_attribute_options_args', 10);
function custom_woocommerce_dropdown_variation_attribute_options_args( $args ) {
// sans condition (if)
$args['show_option_none'] = "Autre chose"; // Remplacer Autre chose
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment