Answer the question
In order to leave comments, you need to log in
Calculation in a single receipt of two different categories of goods with different shipping prices in WooCommerce?
My small online store is built on the WordPress engine. Checkout connected. The shipping cost estimate for the main piece goods works flawlessly. I have the Advanced Flat Rate Shipping For WooCommerce plugin installed. The price of delivery varies depending on the number of pieces of goods. But there is a problem that I can't solve. When adding another piece item to the general cart (which is categorized for sale and not sold according to weight), I need to install free shipping on it. This item must appear on your receipt as free shipping. That is, when forming a basket with different categories of goods, the total check should take into account the different shipping costs for each item (on the screen: one product - shipping is free, the second product - shipping is 9.90). I am not a programmer and the standard Woocommerce settings I can't configure these functions. I'm also trying to make a separate price for shipping using coupons. But in the general check (when adding different categories of goods), the amount of delivery of your choice is taken into account. Please help me to solve this issue, thanks
Answer the question
In order to leave comments, you need to log in
If on the fingers, then something like that, this is purely theoretical and, accordingly, free shipping should be included
function wpp_is_available_free( $is_available ) {
$free_products = [ 22, 55, 44, 66, 22 ];
foreach ( WC()->cart->get_cart() as $key => $item ) {
if ( in_array( $item[ 'product_id' ], $free_products ) ) {
return true;
}
}
return $is_available;
}
add_filter( 'woocommerce_shipping_free_shipping_is_available', 'wpp_is_available_free', 30 );
I'm not a programmer, and I can't set up these functions with the standard Woocommerce settings.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question