【问题标题】:Change the paypal item name in the PayPal Express Checkout plugin更改 PayPal Express Checkout 插件中的 paypal 项目名称
【发布时间】:2020-06-27 08:34:02
【问题描述】:

我有一个 WordPress 网站,它使用 PayPal Checkout 插件进行 woocommerce。 https://wordpress.org/plugins/woocommerce-gateway-paypal-express-checkout/

我需要更改 PayPal 项目名称,我在 functions.php 中使用此代码,它适用于普通的 PayPal 插件,但不适用于 PayPal Express 结帐。

add_filter( 'woocommerce_paypal_get_order_item_name', 'change_paypal_item_name', 10, 3 );
function change_paypal_item_name( $item_name, $order, $item ) {
    return 'test';
}

有人知道使用 PayPal Express 结账插件更改商品名称的功能吗?

【问题讨论】:

    标签: wordpress express woocommerce paypal


    【解决方案1】:

    快速查看the code,似乎woocommerce_paypal_express_checkout_get_details 是一个过滤器,您可以尝试实施以修改整个$details 数组

    【讨论】:

    • 谢谢,我试过这段代码,但似乎没有用。 add_filter('woocommerce_paypal_express_checkout_get_details', 'change_paypal_item_name', 10, 3);函数 change_paypal_item_name( $details ) { if (count($details['items'])) { $items = array(); foreach ($details['items'] as $item) { $item['name'] = 'test'; $项目[] = $项目; } $details['items'] = $items; } 返回 $details; }
    猜你喜欢
    • 2014-04-11
    • 2013-08-06
    • 2014-02-27
    • 2016-03-15
    • 2018-12-13
    • 2016-12-02
    • 1970-01-01
    • 2017-09-06
    • 2014-12-15
    相关资源
    最近更新 更多