0
votes

I'm using woocommerce as a platform for booking products for delivery, People pay only for the shipping costs but not for the products.

How do I get the total amount to reflect ONLY the shipping costs and not the product prices?

I know I can set the individual product price to zero but I prefer to leave the prices there so that people can sort the items by price. Hopefully it's just a simple hack.

Thanks!

1
Create a shipping rule and assigns this rule to product - Md Hasibur Rahaman
Thanks but then the product prices will still be calculated won't they at checkout? - Adrian Lee

1 Answers

0
votes

Add shipping role and assign them to all. Or create a function that remove the product cost from the total in function.php file.

This might help:

add_action( 'woocommerce_before_calculate_totals', 'add_custom_price' );

    function add_custom_price( $cart_object ) {
        $custom_price = $shipping; // Add the shipping cost
        foreach ( $cart_object->cart_contents as $key => $value ) {
           $value['data']->price = $custom_price;
    }
}