corporalpoon
corporalpoon

Reputation: 229

Remove "Calculate Shipping" Button if item is using flat rate

We have some items in our store that use flat rate shipping. When these items are in the cart, we don't want the "Calculate Shipping" button to show. However, if there are items in the cart that need to calculate, we want it to show.

Is there a way to remove this button using a conditional?

I was trying to loop through the cart items and test for a shipping class in the cart, but it's not working. It ended up removing the shipping cost and keeping the calculate shipping button.

Upvotes: 2

Views: 9064

Answers (3)

Martin
Martin

Reputation: 7

You may want to add the following CSS:

.shipping-calculator-button {
    display:none;
}

Upvotes: -1

VRY
VRY

Reputation: 59

WooCommerce > Settings > Shipping > Deselect “Enable the shipping calculator on the cart page”

i found this on kriesi dot at https://kriesi.at/support/topic/how-to-remove-calculate-shipping/

Upvotes: 5

Alice
Alice

Reputation: 1433

On that condition

add_filter('woocommerce_product_needs_shipping', function(){return false;});

This will stop the calculate button. Otherwise there is no direct hook. You may endup editing your woocommerce theme and editing 'cart\shipping-calculator.php' and applying a logic there. Say you can place your own hook/filter there and set true/false from your outside code.

Upvotes: 5

Related Questions