• Resolved klol

    (@klol)


    Hello, I hope you are well.
    I’m writing to you because I don’t know where to look anymore ^_^
    Everything works perfectly except the subtotal in the basket (basket that opens in slide).
    The prices by product work well with the normal price crossed out, and the reseller price.
    The cart page shows the correct subtotal.
    I built my site with Elementor and I use the “Menu Cart” widget.
    Has this ever happened to you?
    Thanks in advance and have a nice evening
    Carole

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Fauzan Azizie

    (@fauzanade)

    Hi @klol,

    Could you please add the following snippet to your child theme’s function.php:

    add_filter( 'woocommerce_cart_item_price' , function( $price, $cart_item, $cart_item_key) {
        global $wc_wholesale_prices;
        $wwp_wholesale_role = $wc_wholesale_prices->wwp_wholesale_roles->getUserWholesaleRole();
        if( !empty( $wwp_wholesale_role ) ) {
            $wwp_wholesale_prices_instance = new WWP_Wholesale_Prices( array() );
            $product = wc_get_product( $cart_item['product_id'] ); // replace with product id
            $get_price_html = $product->get_price();
            if( $product->is_type( 'variation' ) ) {
                $parent = wc_get_product( $product->get_parent_id() );
                $get_price_html = $parent->get_price_html();
            }
            return $wwp_wholesale_prices_instance->wholesale_price_html_filter( $get_price_html , $product , $wwp_wholesale_role );
        }
        return $price;
    } , 10 , 3 );
    
    global $wc_wholesale_prices;
    add_action( 'woocommerce_before_mini_cart_contents' , array( $wc_wholesale_prices->wwp_wholesale_prices , 'recalculate_cart_totals' ) );

    Please let me know how it goes ??

    Thread Starter klol

    (@klol)

    Thank you for everything!!!
    I don’t know why I had all this code except the last two lines.
    It works perfectly.
    Very nice day

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Subtotal is not correct’ is closed to new replies.