【问题标题】:Disable shipping method on Dokan if the store is closed如果商店关闭,请在 Dokan 上禁用送货方式
【发布时间】:2020-06-27 16:22:58
【问题描述】:

有没有办法使用此代码来禁用特定的送货方式?例如,如果我想使用“统一费率”的方法,并且如果商店关门,我希望这种方法不出现。

我尝试用实例 id 为“6”的 woocommerce_load_shipping_methods 替换 is_purchasable 挂钩,但这没有用。

下面是用于禁用购买的代码,但不是运输方式。

add_filter( 'woocommerce_is_purchasable', 'prefix_woocommerce_is_purchasable', 10, 2 );
function prefix_woocommerce_is_purchasable( $is_purchasable, $product ) {

// Get the store id.
$store_id = get_post_field( 'post_author', $product->get_id() );

// Get the store info.
$store_info = dokan_get_store_info( $store_id );

// Get the store time enabled or not.
$is_dokan_store_time_enabled = $store_info['dokan_store_time_enabled'];

// If the store time is enabled, check whether the store is open or not.
// Else the store is open.
if ( 'yes' === $is_dokan_store_time_enabled ) {
    $is_purchasable = dokan_is_store_open( $store_id );     
} else  {
    $is_purchasable = true;
}

return $is_purchasable;

}

【问题讨论】:

    标签: php wordpress woocommerce shipping dokan


    【解决方案1】:

    您可以在子主题的 functions.php 文件中尝试此代码。

    remove_filter( 'woocommerce_cart_shipping_packages', 
    'dokan_custom_split_shipping_packages' );
    

    使用此代码将禁用 Dokan 啜饮。管理员将从后端管理运输(WooCommerce Shipping)

    【讨论】:

    • 我们已经在 Stripe Connect 配置中进行了尝试。在 Dokan 设置中,我们有一个管理员佣金,并且配置的运费转到管理员。结帐后,供应商会根据所售产品获得正确的付款。管理员通过条纹中的“收取的费用”获得正确的佣金。但是我们无法查明是否收取运费,如果收取,它会去哪里。它没有显示在管理条连接上的“收取的费用”下,也没有显示在供应商付款中。然而 woocommerce 订单显示已收取费用。
    猜你喜欢
    • 2019-05-05
    • 1970-01-01
    • 1970-01-01
    • 2021-06-07
    • 1970-01-01
    • 2020-08-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多