• Resolved hatchbackcreative

    (@hatchbackcreative)


    Hello,

    We are trying to edit the Description line when viewing transaction details in the Stripe interface. We have used snippets found in support articles to try and create this, but it doesn’t appear to be working. Here’s what we have. Could you take a look and let us know where the error in the code is?

    add_filter(‘wc_stripe_payment_intent_args’, function($args){
    $theOrder = $order->get_order_number();
    $items = $theOrder->get_items();
    $cat_names = array();
    foreach ( $items as $item ) {
    $product_id = $item->get_product_id();
    $terms = get_the_terms ( $product_id, ‘product_cat’ );
    foreach ( $terms as $term ) {
    $cat_names[] = $term->name;
    }
    }
    $cats = implode(‘, ‘, $cat_names);
    $args[‘description’] = sprintf(‘Order %1$s’, $cats);
    return $args;
    });

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi there @hatchbackcreative ??

    Thank you for contacting Woo support!

    Editing Stripe Description line to include product category

    I went ahead with checking out the source code of the page at https://sacramentovalleyconservancy.org/donate-now/, and it appears to be using the GiveWP plugin. Below is a screenshot, showcasing this:

    Direct link to image: https://snipboard.io/epuUCH.jpg

    I recommend reaching out to their support channel, as they would be in a better position to assist you:

    https://www.ads-software.com/support/plugin/give/

    Have a great one!

    Thread Starter hatchbackcreative

    (@hatchbackcreative)

    Hello, thank you for taking a look, but we have Woocommerce with regular products as well. That’s what we’re looking to edit for the Stripe description line.

    I figure it would be a different fix entirely with GiveWP and we’re not too concerned with that right now.

    Hi there @hatchbackcreative

    we have Woocommerce with regular products as well

    Could you provide an example product URL, please?

    To help you further, I’d like to understand more about your setup.

    Could you please send me a copy of your site’s System Status? You can find it via WooCommerce > Status. Select Get system report and then Copy for support.

    Once you’ve done that, you can paste it here or into our https://Quickforget.com service and send that secret link here.

    We await your response to better assist you.

    Thread Starter hatchbackcreative

    (@hatchbackcreative)

    Yes, here is the product we are using for testing. https://sacramentovalleyconservancy.org/product/widget/

    After I purchase the product for testing, I log in to Stripe to check the Payments tab and see what is in the Description line. We are trying to get the Order # and Product Category. Currently for product sales it has NAMEOFTHESITE – ORDER# (see here).

    Here is the system status report. I made sure to update all Woocommerce plugins. Thank you for your assistance. Let me know if you need any other information.

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @hatchbackcreative

    From the code snippet you shared, I understand you’re trying to include the product category in the Stripe transaction description. However, it looks like there is a missing step in your code. You’re trying to get the order from $order variable which isn’t defined in your function scope. You need to get the order from the $args array like so:

    add_filter('wc_stripe_payment_intent_args', function($args){
    $order_id = $args['metadata']['order_id'];
    $theOrder = wc_get_order($order_id);

    Next, you’re trying to get the items from the order object, but you’re using $theOrder variable which is a string (order number), not an order object. You should use $theOrder->get_items() instead:

    $items = $theOrder->get_items();

    Please note that custom coding is not something we can assist with directly. However, If you have any further questions on development or custom coding, don’t hesitate to reach out to some of our great resources available for support. Our WooCommerce community is brimming with skilled open-source developers who are active on the following channels:

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Editing Stripe Description line to include product category’ is closed to new replies.