woocommerce payfast 根据购买的产品向商家 ID 拆分付款?

问题描述 投票:0回答:1

基于此链接Payfast split payment,这似乎有效。如何运营多供应商 woocommerce 商店,然后根据购买的产品将付款分配给相关商家?

wordpress woocommerce payfast
1个回答
0
投票

通常,此信息存储在订单项目级别。因此,您需要循环遍历项目,获取供应商 ID 并执行拆分付款操作。 例如。在管理订单页面上就像这样:

global $order;
$items = $order->get_items();
foreach ( $items as $item_key => $item ) {
    $vendor_id = wc_get_order_item_meta(  $item_key,  '_vendor_id', true );
    // Now get the merchant id with $vendor_id (=user id) and do split payment. 
    // You can also create an array with $merchant_id => $item->get_subtotal() 
    // and do the split payment after the loop.
}

元键“_vendor_id”取决于您的插件 - 我使用了 WCMP(WooCommerce 的多供应商市场解决方案 - WC Marketplace)。您可能需要在数据库中查找该字段的名称。

© www.soinside.com 2019 - 2024. All rights reserved.