Add data passed through drupal_alter via $context

Created on 2 August 2018, about 7 years ago
Updated 18 August 2025, 18 days ago

The way Commerce Stripe and Card on File interact does not meet my needs. If the user registers up front, all the metadata is present in Stripe. However, when the user is anonymous and chooses to save a card on file, metadata is missing. This is due to the processing order between Commerce Stripe and Card on FIle.

I want to intercept this before Commerce Stripe does its payment processing, so I can add user metadata for an anonymous user who has decided to save a card on file. The easiest way to do this is tacking on to the drupal_alter that already exists.

With the attached patch, I have changed $order to instead be part of a generic $context array which also passes the $pane_values data. This lets me check to see if the "Store this credit card on file for future use" checkbox has been selected, and pull in user data accordingly.

It also allows drupal_alter to be more flexible by passing an alterable $context, which is what is recommended in the API (https://api.drupal.org/api/drupal/includes%21module.inc/function/drupal_...)

Please review the patch, thanks.

✨ Feature request
Status

Closed: outdated

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States ron_s

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.

Production build 0.71.5 2024