add_filter(‘woocommerce_package_rates’, ‘free_shipping_for_logged_in_users’, 10, 2); function free_shipping_for_logged_in_users($rates, $package) { if (is_user_logged_in()) { foreach ($rates as $rate_id => $rate) { if (‘free_shipping’ === $rate->method_id) { $rates[$rate_id]->cost = 0; break; } } } return $rates; }
Category: WordPress
Plug-ins(37)
Customize order confirmation email
add_filter('woocommerce_email_subject_new_order', 'custom_email_subject', 1, 2); function custom_email_subject($subject, $order) { $subject = 'Thank you for your order from XYZ Store!'; return $subject; }
Set minimum order quantity for products
add_filter('woocommerce_quantity_input_args', 'set_min_product_quantity'); function set_min_product_quantity($args) { $args['min_value'] = 2; // Set minimum order quantity to 2 return $args; }
Change shipping costs based on the shopping cart value
add_filter(‘woocommerce_package_rates’, ‘custom_shipping_costs’, 10, 2); function custom_shipping_costs($rates, $package) { $cart_total = WC()->cart->get_cart_contents_total(); if ($cart_total > 100) { foreach ($rates as $rate_id => $rate) { if (‘flat_rate’ === $rate->method_id) { $rates[$rate_id]->cost = 0; // Kostenloser Versand, wenn der Warenkorbwert über 100 liegt } } } return $rates; }
Add custom checkout fields
add_filter('woocommerce_checkout_fields', 'custom_checkout_fields'); function custom_checkout_fields($fields) { $fields['billing']['billing_phone']['required'] = true; $fields['shipping']['shipping_company'] = array( 'label' => 'Company name', 'required' => false, 'class' => array('form-row-wide') ); return $fields; }
Sort products by date instead of standard order
add_filter('woocommerce_get_catalog_ordering_args', 'custom_product_order'); function custom_product_order($args) { $args['orderby'] = 'date'; $args['order'] = 'DESC'; return $args; }
Enable free shipping for certain products
add_filter('woocommerce_package_rates', 'free_shipping_for_specific_products', 10, 2); function free_shipping_for_specific_products($rates, $package) { $specific_product_ids = array(1, 2, 3); // IDs of the products for which free shipping should be activated $is_free_shipping = false; foreach ($package['contents'] as $item) { if (in_array($item['product_id'], $specific_product_ids)) { $is_free_shipping = true; break; } } if ($is_free_shipping) { foreach ($rates as $rate_id => $rate) { if ('free_shipping' === […]
Show custom text message in shopping cart
add_filter('woocommerce_cart_totals_after_order_total', 'custom_cart_message'); function custom_cart_message() { echo '<p>Shipping costs are calculated at checkout.</p>'; }
Step-by-step instructions for installing and configuring WooCommerce and Germanized Pro for your German online shop
In this article, we will show you exactly how to install and set up these two important tools to ensure that your online store complies with the legal requirements in Germany. Step 1: Prepare WordPress Before we can start with WooCommerce and Germanized Pro, you need a working WordPress website. If you don't have WordPress installed yet, you can […]

Required PHP Extensions for WordPress
Required PHP extensions for WordPress WordPress is a PHP-based platform that runs on a web server. To get the most out of WordPress, you need certain PHP extensions. In this article, we will list the required PHP extensions for WordPress, divided into mandatory, optional and suggested extensions. Mandatory extensions These extensions are essential for WordPress […]