コード例 #1
0
function wccm_woocommerce_delivery_notes_compat($fields, $order)
{
    $options = get_option('wccs_settings');
    $new_fields = array();
    if (count($options['buttons']) > 0) {
        foreach ($options['buttons'] as $btn) {
            if (get_post_meta($order->id, '' . $btn['cow'] . '', true)) {
                $new_fields['' . $btn['cow'] . ''] = array('label' => '' . wpml_string_wccm($btn['label']) . '', 'value' => get_post_meta($order->id, '' . $btn['cow'] . '', true));
            }
        }
    }
    return array_merge($fields, $new_fields);
}
function wccm_woocommerce_delivery_notes_compat($fields, $order)
{
    $options = get_option('wccs_settings');
    $new_fields = array();
    if (count($options['buttons']) > 0) {
        $i = 0;
        // Loop through each button
        foreach ($options['buttons'] as $btn) {
            if (get_post_meta($order->id, '' . wooccm_clean($btn['label']) . '', true) && ($btn['type'] !== 'multiselect' || $btn['type'] !== 'multicheckbox') && $btn['type'] !== 'heading') {
                $new_fields['' . $btn['cow'] . ''] = array('label' => '' . wpml_string_wccm($btn['label']) . '', 'value' => get_post_meta($order->id, '' . wooccm_clean($btn['label']) . '', true));
            }
            if (get_post_meta($order->id, '' . wooccm_clean($btn['label']) . '', true) && ($btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox') && $btn['type'] !== 'heading') {
                $new_fields['' . $btn['cow'] . '']['label'] = '' . wpml_string_wccm($btn['label']) . '';
                $new_fields['' . $btn['cow'] . '']['value'] = '';
                $strings = unserialize(get_post_meta($order->id, '' . wooccm_clean($btn['label']) . '', true));
                $iww = 0;
                foreach ($strings as $key) {
                    if ($iww == count($strings) - 1) {
                        $new_fields['' . $btn['cow'] . '']['value'] .= $key;
                    } else {
                        $new_fields['' . $btn['cow'] . '']['value'] .= $key . ', ';
                    }
                    $iww++;
                }
            }
            $i++;
        }
    }
    return array_merge($fields, $new_fields);
}
コード例 #3
0
function order_comments_wccs_override($fields)
{
    $options = get_option('wccs_settings');
    if (!empty($options['replace']['label11'])) {
        $fields['order']['order_comments']['label'] = wpml_string_wccm($options['replace']['label11']);
    }
    if (!empty($options['replace']['placeholder11'])) {
        $fields['order']['order_comments']['placeholder'] = wpml_string_wccm($options['replace']['placeholder11']);
    }
    return $fields;
}