1

enter image description here

1- As I have marked in the image with a red box, I want to display a desired text in this section

For example, when the user chooses to pay by check, display a text stating what conditions the check should have... And when he chooses another payment method, another desired text will be displayed


2- How to control a payment gateway?

For example, if the check payment method can be controlled and accessed with 'check', how can the other public and private payment methods be accessed and controlled? That is, where and how to get their name (eg 'check')?

If a site has 3 payment methods Check method Method A Method B How to access these three payment methods? By choosing each one, a specific task can be done

Adam Luper
  • 230
  • 9
  • Here is a [visual representation of all hooks in the checkout page](https://www.businessbloomer.com/woocommerce-visual-hook-guide-checkout-page/#more-19782), from there you can build a hooked function that will display different hidden texts, each with its own div like ``. Then with a bit of jQuery/JavaScript you can show the right text on selected payment gateway… So it's up to you to make your code attempt as there are a lot of related answers in Stack Overflow, where you can pick some code. – LoicTheAztec Jul 20 '23 at 11:57
  • Thank you Is there a way to do this without using jQuery/JavaScript and just PHP? This is because the end user may have turned off or disabled JavaScript in his browser. – Adam Luper Jul 20 '23 at 12:12
  • How to get the ID of a payment gateway? https://stackoverflow.com/a/45747620 I used this method, but the path mentioned (WooCoomerce > Settings > Checkout > Gateway display order) does not exist in the new version of WooCommerce! – Adam Luper Jul 20 '23 at 12:14
  • U need to use ajax to run your php function so you need jquery/java. https://wordpress.stackexchange.com/questions/342148/list-of-js-events-in-the-woocommerce-frontend – Snuffy Jul 20 '23 at 12:51
  • 1
    Is this that you are looking for: [How to get the payment gateway ID in WooCommerce?](https://stackoverflow.com/questions/76605181/how-to-get-the-id-of-a-payment-method-in-woocommerce/76606648#76606648) – LoicTheAztec Jul 20 '23 at 13:15
  • @Snuffy Sorry but AJAX is not really needed… Of course, you can use all JavaScript WooCommerce document.body delegated events. – LoicTheAztec Jul 20 '23 at 13:35
  • @LoicTheAztec If its a single payment method sure but he have more than one and will not update when user changes the payment method. – Snuffy Jul 20 '23 at 13:53
  • @LoicTheAztec, Great as always and thank you for your help. – Adam Luper Jul 20 '23 at 14:01
  • 1
    @Snuffy Ajax is not needed, jQuery yes (but without Ajax), think about it. The OP has 3 payment methods, and with few lines of jQuery code you can detect the payment method selected or changed, then you show the right text and hide the others... – LoicTheAztec Jul 20 '23 at 16:23
  • @LoicTheAztec yes sure you can go with pure jquery. – Snuffy Jul 21 '23 at 09:02

0 Answers0