WordPress电商网站设置满$30免运费功能技术求助
Hey there! Let's figure out how to set up that free shipping for orders over $30 on your WordPress store—this is such a common request, and there are a couple of straightforward ways to pull it off, depending on how comfortable you are with code or using built-in tools.
Chances are you're using WooCommerce for your store (it's the most popular WordPress e-commerce plugin), and it has this feature built right in—no extra plugins or code required:
- Head to your WordPress dashboard, go to WooCommerce > Settings > Shipping
- Click on the shipping zone you're using (like "Domestic Shipping"), then hit "Add shipping method" and select "Free Shipping"
- In the free shipping settings, look for "Minimum order amount" and enter
30(double-check that your store's currency is set to USD so this matches your $30 threshold) - Save your changes! Now, whenever a customer's order total hits $30 or more, the free shipping option will automatically show up as available. You can also adjust your existing paid shipping methods to only display when orders are under $30, so customers don't see conflicting options.
If you want to tweak existing shipping rates instead of adding a separate free shipping option, or if you're using a different e-commerce plugin that doesn't have this built-in, you can add custom code to your site:
- Open your theme's
functions.phpfile (or use a custom code snippet plugin to avoid losing changes when your theme updates) - Paste in this code:
add_filter( 'woocommerce_package_rates', 'custom_free_shipping_threshold', 10, 2 ); function custom_free_shipping_threshold( $rates, $package ) { // Set your free shipping threshold amount $min_order_amount = 30; // Get the current cart total $cart_total = WC()->cart->get_cart_contents_total(); // Loop through all available shipping rates foreach ( $rates as $rate_key => $rate ) { // If cart meets the threshold, set shipping cost to 0 if ( $cart_total >= $min_order_amount ) { $rates[$rate_key]->cost = 0; // Also clear any taxes associated with the shipping $rates[$rate_key]->taxes = array(); } } return $rates; }
- This code will check the customer's cart total every time they view the shipping options. If it's $30 or more, it'll zero out the cost of all available shipping methods, including any associated taxes.
Quick Notes to Keep in Mind
- If you're using a non-WooCommerce e-commerce plugin, check its settings first—most major plugins have a similar "minimum order for free shipping" toggle hidden in their shipping settings.
- Always test this setup with a test order: add items to reach $30, go through checkout, and confirm the shipping cost drops to 0. Also test an order under $30 to make sure your regular shipping rates still work as expected.
内容的提问来源于stack exchange,提问作者Abdullah Al Shahariar

