Skip to main content
WB2
Réécrire fonction w...
 
Notifications
Retirer tout

Réécrire fonction woocommerce

5 Publications
2 Utilisateurs
0 Reactions
2 Vu
(@julien)
Publications: 16
Eminent Member
Début du sujet
 
[#1091]

Bonjour je voudrais réécrire une fonction de woocommerce et je n'arrive pas

Comment je dois faire ?

if ( ! function_exists( 'woocommerce_widget_shopping_cart_button_view_cart' ) ) {

   /**
    * Output the view cart button.
    *
    * @subpackage Cart
    */
   function woocommerce_widget_shopping_cart_button_view_cart() {
      echo '. esc_url( wc_get_cart_url() ) . '/#yith" class="button wc-forward test">' . esc_html__( 'View cart', 'woocommerce' ) . '';
   }
}

 
Posté : 05/02/2018 2:28 pm
(@mathieu67)
Publications: 645
Honorable Member
 

Quel résultat souhaitez vous avoir ?

La 1re étape est de voir si le thème peut être mis à jour. Si c'est le cas, vous devrez créer un thème enfant sinon, à la prochaine mise à jour du thème, vos modifications seront écrasées :
https://codex.wordpress.org/fr:Th%C3%A8mes_Enfant
Et sinon vous pouvez modifier directement les fichiers du thème.


 
Posté : 05/02/2018 2:48 pm
(@julien)
Publications: 16
Eminent Member
Début du sujet
 

En faite je veux juste réécrire la fonction comme plus haut

 

function woocommerce_widget_shopping_cart_button_view_cart() {
      echo '. esc_url( wc_get_cart_url() ) . '/#yith" class="button wc-forward test">' . esc_html__( 'View cart', 'woocommerce' ) . '';
   }

Pour avoir /#yith à la suite de l'url du panier.

Et j'ai créer un thème enfant.

 


 
Posté : 05/02/2018 3:09 pm
(@mathieu67)
Publications: 645
Honorable Member
 

il suffit de mettre cette fonction dans le fichier functions.php du thème enfant et WooCommerce l'utilisera en priorité.


 
Posté : 05/02/2018 3:57 pm
(@julien)
Publications: 16
Eminent Member
Début du sujet
 

Je viens d'essayer ça ne fonctionne pas il suffit bien de réécrire

function woocommerce_widget_shopping_cart_button_view_cart() {
      echo '. esc_url( wc_get_cart_url() ) . '/#yith" class="button wc-forward test">' . esc_html__( 'View cart', 'woocommerce' ) . '';
   }

Ou toutes la fonction

if ( ! function_exists( 'woocommerce_widget_shopping_cart_button_view_cart' ) ) {

   /**
    * Output the view cart button.
    *
    * @subpackage Cart
    */
   function woocommerce_widget_shopping_cart_button_view_cart() {
      echo '. esc_url( wc_get_cart_url() ) . '/#yith" class="button wc-forward test">' . esc_html__( 'View cart', 'woocommerce' ) . '';
   }
}

 


 
Posté : 05/02/2018 4:07 pm
Share: