Save which language was used during checkout ("checkout_langcode")

Created on 14 September 2022, over 2 years ago
Updated 30 August 2024, 4 months ago

Describe your bug or feature request.

We use Commerce Email module to send notification e-mails when the payment was received and the package is sent to the customer. The problem is if the user didn't register an account, we don't know which language to use in the later e-mails. The order itself doesn't contain any info about that.

I would like to suggest that we save the language code when the order is placed:

$order->setData('checkout_langcode', \Drupal::languageManager()->getCurrentLanguage()->getId());

If a bug, provide steps to reproduce it from a clean install.

Feature request
Status

Needs review

Version

2.0

Component

Checkout

Created by

🇸🇰Slovakia kaszarobert

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    785 pass
  • 🇭🇺Hungary tikaszvince

    reroll patch to make possible to apply on 2.36

  • 🇩🇪Germany Anybody Porta Westfalica

    I just ran into something related and I'm not sure, if it should be solved combined here or as separate issue. I'm NOT using the patch from this issue (yet):

    If you create an order in one language, proceed with the first checkout step (confirm so that the order status changes from cart to something else) and then go back to a regular page with cart, the cart is empty, if you're changing to a different language. Going back into the checkout with that different language, also shows the checkout empty.

    Returning to the original language, the cart content and the checkout shows again. Of course, it would be expected ot see the contents in both languages, just like before the checkout started.

    Is this closely related to this issue or should I better create a separate one?
    Can you reproduce it?

  • 🇫🇷France flocondetoile Lyon

    Is this closely related to this issue

    I don't think. This issue is about adding the langcode on the order once it's completed. To be able to know in which language the order has been completed.

    Can you reproduce it?

    Tried on one of my commerce project and I don't reproduce your issue. I wonder if you do't have some custom code / contrib module which implements permissions based on the language for product / order item.

  • 🇩🇪Germany Anybody Porta Westfalica

    @flocondetoile thanks for your feedback! I'll try to reproduce that in a vanilla Drupal Commerce installation. No modules for that, but of course might be a side effect of another module. I'll try and if I'm able to reproduce it, create a separate issue, thanks!

  • 🇮🇹Italy trickfun

    Path stores checkout language but how can send checkout receipt or resend receipt in checkout language?

    Now i receive mail with user preferred language for some text and user interface language for other text.

    May be usefull to resend mail in checkout language form admin.
    Thank you

  • 🇩🇪Germany Anybody Porta Westfalica

    I guess this still makes sense. At least when finishing the order, the language should be stored into the order entity, so if the user is anonymous or not, we're able to determine in which language the order was made and base all further emails on that.

    At least for customers with a user account, I don't see many further use-cases. Eventually, if you provide further after-sales things like parcel tracking or sth. like that based on the order, it will also be useful.

    All in all it totally makes sense logically to have that information in the order.

  • 🇩🇪Germany Anybody Porta Westfalica

    I guess this should go into 3.0.x then? Do we need anything else here, besides preparing a fresh MR?

    Should the use of this for the order confirmation email be done here or in a follow-up? A related issue at commerce_email should be created, once this is ready.

    Any other final comments @jsacksick? Guess it makes sense to move this over the finish line for the reasons given above...

  • 🇷🇸Serbia bojanz

    There's also the older discussion at 📌 Clarify order language behavior Needs work which might have important information.

Production build 0.71.5 2024