WPML
状态
已由作者解决
解决于
Bookings and Appointments For WooCommerce Premium 5.3.1
主题标签
Compatibility, WCML

问题概述

当将Bookings and Appointments For WooCommerce Premium与 WPML 和 WCML 一起使用时,无法将同一个可预订产品多次添加到购物车。

尝试执行此操作时,会显示以下消息:

“您无法将另一个product name添加到购物车。”

临时解决方法

请在继续操作之前,确保对您的站点进行完整站点备份


  • 将以下代码添加到您主题的 functions.php 文件中。
    // WPML Workaround for compsupp-8226 
    add_filter( 'wcml_add_to_cart_sold_individually', function( $allow, $cart_item_data, $post_id, $qty ) {
        $product = wc_get_product( $post_id );
        if ( $product && 'phive_booking' === $product->get_type() ) {
            return false;
        }
        return $allow;
    }, 10, 4 );
            

所有已知问题 →