Comment personnaliser la position de «ajouter au panier» de WooCommerce sur la page produit
-
-
Regardezma réponseici: http://wordpress.stackexchange.com/a/113189/22534.Btw ce sontbeaucoup de questions,le concept de ce siteest deposer des questions concernant unproblème résoluble.Take look at my answer here: http://wordpress.stackexchange.com/a/113189/22534. Btw those are many questions, the concept of this site is to ask questions concerning one solvable problem.
- 1
- 2013-09-18
- Nicolai
-
Merci @ialocin.J'ai déjà vu cespages de "structure"et j'aipassépasmal detemps àpirater diversfichiersen vain.Désolé si vous avezmalinterprétéma question,maiselle se voulait singulière (et spécifique): Quelfichier (oufichiers,s'il yen aplusieurs) dois-jemodifierpour réorganiser lapageproduit commeindiqué dansma capture d'écran? Je souhaite simplement déplacer lebouton Achetermaintenantet le sélecteur d'attributs au-dessus de la description duproduit. Merciencore.Thank you @ialocin. I have already seen those "structure" pages and spent quite a bit of time hacking around various files to no avail. Sorry if you mis-interpreted my question, but it was intended to be singular (and specific): Which file (or files, if more than one) do I need to edit to re-arrange the Product Page as shown in my screenshot? I just want to move the Buy Now button and Attributes Selector up above the Product Description. Thanks again.
- 0
- 2013-09-21
- Blake Miller
-
Pas deproblème,j'essayejuste d'aider.Voyez,ce que vous avez écrit dans votre commentaireest unproblème avec lequel - quelqu'un -peuttravailler.Jeposte une réponsepour vous,comment résoudre ceproblème.Pouvez-vous réécrire votre questionpour refléter cela?Merci!No problem, I'm just trying to help. See, what you wrote in your comment is a problem I - somebody - can work with. I post an answer for you, how to solve this. Can you please rewrite your question to reflect this? Thanks!
- 0
- 2013-09-21
- Nicolai
-
1 réponses
- votes
-
- 2013-09-21
Vouspouvezfaire ce que vous voulezen vous connectant à l'action
woocommerce_single_product_summary
. L'actionestexécutée danscontent-single-product.php
comme ceci:<?php /** * woocommerce_single_product_summary hook * * @hooked woocommerce_template_single_title - 5 * @hooked woocommerce_template_single_price - 10 * @hooked woocommerce_template_single_excerpt - 20 * @hooked woocommerce_template_single_add_to_cart - 30 * @hooked woocommerce_template_single_meta - 40 * @hooked woocommerce_template_single_sharing - 50 */ do_action( 'woocommerce_single_product_summary' ); ?>
Ci-dessus,vous avez une description/documentation sur lesparties accrochées,lenombre représente laprioritéet/ou l'ordre.
Vouspouvez changer lapriorité/l'ordreen supprimantet en ajoutant ànouveau lesparties dont vous voulez que laposition change - comme ceci:
/** woocommerce: change position of add-to-cart on single product **/ remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 9 );
Déposez cemorceau de code dans votre
functions.php
pourprendreeffet. Lapartie ajout aupanier devraitmaintenant apparaître après letitreet avant leprix,si vous voulez qu'elle s'affiche après leprix -parexemple - choisissez unnuméro - dans le code ci-dessus,sur la ligneadd_action()
-entre 11et 19 ans - Je suis sûr que vous avez compris leprincipemaintenant.You can do what you want by hooking into the
woocommerce_single_product_summary
action. The action is executed insidecontent-single-product.php
like this:<?php /** * woocommerce_single_product_summary hook * * @hooked woocommerce_template_single_title - 5 * @hooked woocommerce_template_single_price - 10 * @hooked woocommerce_template_single_excerpt - 20 * @hooked woocommerce_template_single_add_to_cart - 30 * @hooked woocommerce_template_single_meta - 40 * @hooked woocommerce_template_single_sharing - 50 */ do_action( 'woocommerce_single_product_summary' ); ?>
Above you have a description/documentation about the hooked in parts, the number represents the priority and/or order.
You can change the priority/order by removing and re-adding the parts you want the postion changed - like this:
/** woocommerce: change position of add-to-cart on single product **/ remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 9 );
Drop this piece of code into your
functions.php
to take effect. The add-to-cart part now should show after title and before price, if you want it to show after the price - for example - choose a number - in above code, on theadd_action()
line - between 11 to 19 - I'm sure you are getting the principle by now.-
Celafait longtemps,maisje vous remercie de votre aide.Ça amarché!Unefois quej'ai compris laméthode,j'aifait quelquesmodifications supplémentaires.J'ai égalementmodifiéma questioninitialepourmieux correspondre àmonproblème.Merciencore @ialocinIt's been some time on this, but I thank you for your help. That worked! Once I figured out the method, I made some more edits. I have also changed my original question to better match my problem. Thank you again @ialocin
- 0
- 2013-10-05
- Blake Miller
-
@BlakeMiller Àtoutmoment,heureux que vous ayez compriset que vouspuissiezmaintenant l'utiliser davantage!Si c'est unebonne réponse,cochez-lapour quetout lemonde qui aborde la questionplustard le sache.@BlakeMiller Any time, glad you figured it out and now are able to use it further! If it's a correct answer give it a check mark, so everybody coming to the question later knows that.
- 0
- 2013-10-05
- Nicolai
-
Commentpuis-je lepositionner au-dessus dubouton Ajouter aupaniermais sous les variantes?How can I position it above the Add to Cart button but below variations?
- 0
- 2017-01-20
- MF1
-
@ MF1 Jene suispas sûr,vous devez l'inspecter vous-même.Bonne chance!@MF1 I'm not sure, you've to inspect it yourself. Good luck!
- 0
- 2017-01-23
- Nicolai
Quelfichier (oufichiers s'ilen existeplusieurs) dois-jemodifierpour réorganiser lapageproduit?
Je souhaite apporter desmodifications debase à lamiseen page de lapageproduitpar défaut de Woocommerce.Plusprécisément,je veuxplacer les éléments de la commandejusteen dessous duprixet pousser la description vers lebas.En d'autrestermes,permutez la description courte avec les éléments de la commande (attributs,ajouter aupanier,SKU,etc.) Voici une capture d'écran de ce queje veuxfaire: http://d.pr/i/YGAY