How to programatically set the shipping amount in WooCommerce

I am creating a WordPress plugin that handles the shipping and delivery for WooCommerce.

I want to simply tell my WooCommerce cart (or order), this is what the shipping amount is.

I have tried directly setting WC()->cart->shipping_amount = $amount;,
and also doing ->add_fee( $shippingServiceName, $amount );
in both cases the shipping_amount on the cart remains at 0.

How do I set the shipping amount?

Read more here: How to programatically set the shipping amount in WooCommerce

Leave a Reply

Your email address will not be published. Required fields are marked *