FavoriteLoadingAdd to favorites

Use your discretion and adjust the function as you need it. It should make sense when you read the function. It currently sets a shipping fee based on the total cost of the cart.

// ADD SHIPPING COST
function woo_add_cart_fee() {
    
    if (WC()->cart->cart_contents_total > 1000) {
        WC()->cart->add_fee( __('Shipping', 'woocommerce'), 100 );
    }else{
        WC()->cart->add_fee( __('Shipping', 'woocommerce'), 100 );
    }
}
add_action( 'woocommerce_cart_calculate_fees', 'woo_add_cart_fee' );

Pin It on Pinterest

Share This