Modify the payment description
-
I can see in line 355 of woocommerce-gateway-stripe/includes/abstracts/abstract-wc-stripe-payment-gateway.php:
$post_data['description'] = sprintf( __( '%1$s - Order %2$s', 'woocommerce-gateway-stripe' ), wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ), $order->get_order_number() );
I would like to prefix the description with the product SKU. I have modified my site to only allow one product per order with this function:
add_filter( 'woocommerce_add_to_cart_validation', 'only_one_in_cart', 99, 2 ); function only_one_in_cart( $passed, $added_product_id ) { // empty cart first: new item will replace previous wc_empty_cart(); return $passed; }
I’m not sure how to override this with a hook. Would anyone be able to assist?
The reason I want to do this is because Stripe payout exports do not include metadata fields, so I cannot financially track which product exactly has been purchased, otherwise I would just store the SKU in the extra metadata fields. The payout exports do however show the description field, so if I can get the SKU in there then it would make life a lot easier.
Thank you
edit: I see there is a filter for this function, wc_stripe_generate_payment_request, https://github.com/woocommerce/woocommerce-gateway-stripe/blob/c1ac09f5e11f68d4f07eb7585bd06722351a8195/includes/class-wc-gateway-stripe.php#L413
- The topic ‘Modify the payment description’ is closed to new replies.