• Resolved tommyd17

    (@tommyd17)


    Hi,

    I need to change the Payment description in the stripe dashboard to include the customers billing name.
    I used this filter in the functions.php, but it is not working when testing it with test mode:

    add_filter('wc_stripe_payment_intent_args', function($args, $order){
        $args['description'] = sprintf('Order %1$s', $order->get_order_number(), $order->get_billing_first_name(), $order->get_billing_last_name());
        return $args;
    }, 10, 2);

    Could you help here?
    Thanks, Tom

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Payment Plugins

    (@mrclayton)

    Hi @tommyd17,

    It looks like your use of sprintf is incorrect. When using sprintf you must include placeholders for each argument. Notice you only have one placeholder in your format but you’re passing 3 arguments. It should look like:

    sprintf('Order %s for %s %s', $order->get_order_number(), $order->get_billing_first_name(), $order->get_billing_last_name());

    Kind Regards,

    Thread Starter tommyd17

    (@tommyd17)

    Hi,
    thanks for your message!

    I implemented the code but still the default value is showing in stripe for my test orders (Order # from Store name). I also tried with a text only string, but it is not working as well.

    Could you check it out here: https://staging.hummels-krapferl.at/shop
    You can make a test order if that helps, I activated test mode in stripe
    Is the code bypassed somehow or how can I solve this issue?

    Thanks, Tom

    Plugin Author Payment Plugins

    (@mrclayton)

    Hi @tommyd17,

    It works for me when I test in my development environment. Make sure you’re adding it to the functions.php of your active theme. That could be a child theme.

    Your code is most likely being bypassed.

    Kind Regards,

    Thread Starter tommyd17

    (@tommyd17)

    Hi,

    I added the code

    add_filter('wc_stripe_payment_intent_args', function($args, $order){
        $args['description'] = sprintf('Order %s von %s %s', $order->get_order_number(), $order->get_billing_first_name(), $order->get_billing_last_name());
        return $args;
    }, 10, 2);

    to my active hello elementor theme -> no other custom code snippets in the functions.php!
    Also deactivated all plugins, but WooCommerce and Stripe for WooCommerce.

    The value is still not right in stripe.
    Could I provide you with wp-admin to check this out for me? Or do I need to set anything else?

    Thanks, tom

    Plugin Author Payment Plugins

    (@mrclayton)

    Hi @tommyd17

    This looks to be an issue with your code being bypassed and is not a plugin issue.

    I recommend seeing if you need to do anything differently since you’re using Elementor. They may have a different process for adding custom code snippets.

    Kind regards

    Thread Starter tommyd17

    (@tommyd17)

    Hi,

    I switched theme to storefront and added the code there – still no luck.

    Thanks, Tom

    Plugin Author Payment Plugins

    (@mrclayton)

    Add a log statement to your code and if no log entry is created you’ll know your code isn’t being called.

    Thread Starter tommyd17

    (@tommyd17)

    Okay I tried that but there is no log.
    How can I prevent the code from being bypassed?

    Thanks!

    Plugin Author Payment Plugins

    (@mrclayton)

    @tommyd17,

    The answer to that question depends on a lot of factors. I recommend you search for some stackoverflow threads or similar to see if others had custom code being bypassed.

    The Stripe plugin is not the reason your code is bypassed so I can’t really say for sure why that’s happening.

    Kind Regards,

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘payment description in stripe dashboard’ is closed to new replies.