mollie / WooCommerce

Official Mollie extension for WooCommerce
https://wordpress.org/plugins/mollie-payments-for-woocommerce/
Other
131 stars 53 forks source link

Description is hardcoded to 'Order X' #364

Closed synio-wesley closed 3 years ago

synio-wesley commented 4 years ago

It looks like it's not possible to change the description to something else. One of my clients has requested a custom description. Would it be accepted if I would add a PR where the payment_description can be filtered in WP so I can handle it in custom code?

Something like: apply_filters(Mollie_WC_Plugin::PLUGIN_ID . '_payment_description', $payment_description, $order, $customer_id);

synio-wesley commented 4 years ago

Ok, upon further research it looks like there is a _create_payment action, but it doesn't allow to change the $data.. perhaps it would be better to make this a filter?

synio-wesley commented 4 years ago

For now, I was able to solve the problem by using the woocommerce_{$gateway}_args filter, but I need to add it to all the gateways.. It doesn't feel like the best solution.

foreach (\Mollie_WC_Plugin::$GATEWAYS as $gateway) {
    $gateway = strtolower($gateway);
    add_filter("woocommerce_{$gateway}_args", function ($data, $order) {
        $data['description'] = __('Custom text', 'text-domain') . ' ' . $order->id;
        return $data;
    }, 10, 2);
}
InpsydeNiklas commented 3 years ago

Hi @synio-wesley, In case this is still relevant for you or anyone else, we recently integrated a feature to set a different payment description when using the payments API. image It's not fully customizable and only works with payments, but we may expand the functionality in the future depending on the feedback we receive. Kind regards, Niklas

jicao commented 2 years ago

Hello,

Hope that you'll make this editable in both API (Payment & Order) with an input text field with all {orderNumber} {storeName} etc available.

Thanks to @synio-wesley for his workaround !

mkleijn commented 7 months ago

@InpsydeNiklas I'd like to second the request of @jicao to have these {variables} work with the Order API as well. Any chance this will be on the roadmap?