This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 5 replies, has 2 voices.

Last updated by Jamal 1 month, 2 weeks ago.

Assigned support staff: Jamal.

Author Posts
August 23, 2019 at 11:45 am #4446503

mardinS

Hi,

We want to have different checkouts for each URL. How can we do that?

August 23, 2019 at 1:33 pm #4447651

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

Thank you for contacting WPML Support. I will be glad to help with this.

The checkout page is like any normal page, you will need to translate it and specify the slug that you would like for it.
https://wpml.org/documentation/getting-started-guide/

If you still have doubts, please allow me temporary access to your website, after a full backup. And tell me what URL would you like to use and I will correct it or show you how to do it.

Best regards,
Jamal
WPML Support

August 23, 2019 at 1:42 pm #4447801

mardinS

What I mean is that we want to have completely different payment methods for each checkout. So for the .se and .de URL:s, we want to use Klarna Checkout and for the rest of the URL:s, we want to use PayPal and Stripe payment.

August 23, 2019 at 2:15 pm #4448079

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

You can use a similar function to the following and adapt it to your needs:

function wpml_filter_gateways($gateways){
     $lang = apply_filters( 'wpml_current_language', NULL );
     if($lang == 'fr') //Checks if the selected language is French.
          unset($gateways['paypal']); //"remove" paypal
 
     return $gateways; //returns the other payment methods.
}
add_filter('woocommerce_available_payment_gateways','wpml_filter_gateways',1);

More info on the WPML hook used here https://wpml.org/wpml-hook/wpml_current_language/

Best regards,
Jamal

August 26, 2019 at 4:59 pm #4460471

mardinS

Hi again Jamal,

So by entering this code on the website there will be separate checkouts per domain?
What if there are WordPress updates, plugin updates etc?
Is there any other option?

Truth is, I don't know coding at all so this won't get me far if you don't explain a bit more. Do you think you could walk me trough it step by step while explaining so I can understand what we're doing throughout?

Best regards,
Mardin

August 26, 2019 at 6:00 pm #4460727

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

To avoid losing the changes because of an update, I suggest you add the code to your child theme or in a special plugin.
The code as-is will not resolve the issues for you, it is provided as a reference and it will need testing and adapting according to your use case.
But If you are not comfortable with coding, we won't be able to help. Custom coding is out of the scope of the support forum. I suggest you contact one of our partners from this page https://wpml.org/contractors/

Best regards,
Jamal