Tmp / Not used

0.0/5
<?php
/*add_filter('woocommerce_package_rates', 'my_hide_shipping_when_free_is_available', 100);
function my_hide_shipping_when_free_is_available($rates)
{
	global $wpdb;
	global $woocommerce;
	    $count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM " . $wpdb->prefix . "wc_customer_lookup WHERE `email` = %s", WC()->customer->get_email()));
	if($count > 1){
    $customer_id = $wpdb->get_var($wpdb->prepare("SELECT customer_id FROM " . $wpdb->prefix . "wc_customer_lookup WHERE `email` = %s", WC()->customer->get_email()));
    $subscriptions = wcs_get_subscriptions(array(
        'customer_id' => $customer_id,
        'subscription_status' => 'wc-active',
    ));
    if (count($subscriptions) > 0)
    {
        $free = array();

        foreach ($rates as $rate_id => $rate)
        {
            if ('free_shipping' === $rate->method_id)
            {
                $free[$rate_id] = $rate;
                break;
            }
        }

        return !empty($free) ? $free : $rates;
    }
	}
	return $rates;
}*/

/*add_action('woocommerce_review_order_before_shipping', 'before_shipping');

function before_shipping($checkout)
{
	global $woocommerce;
	global $wpdb;
	    $count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM " . $wpdb->prefix . "wc_customer_lookup WHERE `email` = %s", WC()->customer->get_email()));
	if($count > 1){
    $customer_id = $wpdb->get_var($wpdb->prepare("SELECT customer_id FROM " . $wpdb->prefix . "wc_customer_lookup WHERE `email` = %s", WC()->customer->get_email()));
    $subscriptions = wcs_get_subscriptions(array(
        'customer_id' => $customer_id,
        'subscription_status' => 'wc-active',
    ));
    if (count($subscriptions) > 0)
    {
        $woocommerce
            ->session
            ->set('chosen_shipping_methods', array(
            'free_shipping'
        ));
    }
	}
	
	

}


add_filter('zasilkovna_shipping_cost', 'wpdd_zasilkovna_shipping_cost', 10, 3); 
function wpdd_zasilkovna_shipping_cost($checkout, $moje_country, $weight)
{
	return is_groomi_subscriber() ? 0 : $checkout;
	
}


add_filter('zasilkovana_free_shipping_filter', 'wpdd_free_shipping', 10); //zasilkovana není překlep :))))))))))))))))))))))) 
function wpdd_free_shipping($checkout)
{
	return is_groomi_subscriber() ? 0 : $checkout;
}


*/
	
	
//add_filter('zasilkovna_override_shipping_cost', 'wpdd_zasilkovna_shipping_cost', 10, 3); 

Comments and reviews

{{ reviewsTotal }} Review
{{ reviewsTotal }} Reviews
{{ options.labels.newReviewButton }}
{{ userData.canReview.message }}

Description

This snippet was fetched automatically from WPDistro.cz projects.

Author

Tags

This snippet is untagged