C++, не установленный в Cygwin

Обновление (2019) - Вы должны подумать, что иначе, используя woocommerce_email_recipient_new_order для добавления определенных получателей электронной почты в зависимости от зоны доставки:

add_filter( 'woocommerce_email_recipient_new_order', 'custom_email_recipient_new_order', 10, 2 );
function custom_email_recipient_new_order( $recipient, $order ) {
    // Avoiding backend displayed error in Woocommerce email settings
    if ( ! is_a( $order, 'WC_Order' ) ) 
        return $recipient;

    // Get the shipping country and postcode
    $country_code = $order->get_shipping_country();
    $postcode     = $order->get_shipping_postcode();

    // Get All Zone IDs
    $zone_ids    = array_keys( array('') + WC_Shipping_Zones::get_zones() );

    // Loop through Zone IDs
    foreach ( $zone_ids as $zone_id ) {
        // Get the shipping Zone object
        $shipping_zone = new WC_Shipping_Zone($zone_id);

        // Loop through Zone locations
        foreach ( $shipping_zone->get_zone_locations() as $location ){
            if ( ( $location->type === 'postcode' && $location->code === $postcode ) 
            || ( $location->type === 'country' && $location->code === $country_code ) ) {
                $the_zone_id   = $zone_id;
                $the_zone_name = $shipping_zone->get_zone_name(); // (You can use the the zone name too)
                break;
            } 
        }
        if($found) break;
    }

    if( $the_zone_id == 0 ) {
        $recipient .= ',' . 'james.collins@gmail.com';
    } elseif( $the_zone_id == 2 ) {
        $recipient .= ',' . 'jean.dubreuil@gmail.com';
    } elseif( $the_zone_id == 3 ) {
        $recipient .= ',' . 'joel.chalamousse@gmail.com';
    } else {
        $recipient .= ',' . 'isabelle.frottin@gmail.com';
    }

    return $recipient;
}

Код помещается в файл function.php вашей активной детской темы (или активной темы). Это должно работать.

14
задан Saobi 13 May 2009 в 01:15
поделиться

2 ответа

Вы установили пакеты Devel ?

Я предлагаю вам прочитать этот учебник , чтобы начать работу.

19
ответ дан 1 December 2019 в 09:02
поделиться

Хорошая идея - просто установить все с CygWin. Когда вы запускаете установку, просто нажимайте на круглый значок на верхнем уровне, пока он не покажет «Полный», а не «По умолчанию» - это установит все пакеты.

У меня иногда возникали проблемы с установкой отдельных пакетов из-за зависимостей, но полная установка не подвержена этой же проблеме.

Дисковое пространство дешево, ваше время, потраченное на выяснение, почему что-то не работает, - нет.

11
ответ дан 1 December 2019 в 09:02
поделиться
Другие вопросы по тегам:

Похожие вопросы: