Enable free shipping for registered users

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; }  

Read More

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; }

Read More

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; }

Read More

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; }

Read More

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' === […]

Read More
image 1694082415 scaled

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 […]

Read More