• ssurfer

    (@ssurfer)


    Hi,

    could you add an condition to only add visible products?

    in woocommerce.php on row 578:

    `if ( ! apply_filters( GTM4WP_WPFILTER_EEC_CART_ITEM, true, $cart_item_data ) || ! apply_filters( ‘woocommerce_widget_cart_item_visible’, true, $cart_item_data, $cart_item_id ) ) {
    continue;
    }

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ssurfer

    (@ssurfer)

    An other question, why do you calculate the price of each product in cart from wc_get_price_to_display( $product ).

    Doesn’t it make sense to use the prices of the cart? In this case if you have added a coupon the correct price will be in the dataLayer variable.

    Plugin Author Thomas Geiger

    (@duracelltomi)

    Hi,

    Thanks for noting that missing peace of code.
    I prepared the commit to GitHub.

    wc_get_price_to_display() is used to make sure that prices passed to the data layer respect the woocommerce_tax_display_shop WooCommerce option.

    I wonder if the following line does the same but with the addition of coupon code calculations:

    $product_price = apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key );

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Woocommerce invisible products’ is closed to new replies.