当前位置: 首页>>代码示例>>PHP>>正文


PHP wc_get_coupon_type函数代码示例

本文整理汇总了PHP中wc_get_coupon_type函数的典型用法代码示例。如果您正苦于以下问题:PHP wc_get_coupon_type函数的具体用法?PHP wc_get_coupon_type怎么用?PHP wc_get_coupon_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wc_get_coupon_type函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: rf_custom_columns

/**
 * Define our custom columns shown in admin.
 * @param  string $column
 *
 */
function rf_custom_columns($column)
{
    global $post, $woocommerce;
    switch ($column) {
        case "coupon_type":
            echo esc_html(wc_get_coupon_type(get_post_meta($post->ID, 'rf_coupon_type', true)));
            break;
        case "coupon_amount":
            echo esc_html(get_post_meta($post->ID, 'rf_coupon_amount', true));
            break;
        case "description":
            echo esc_html(get_post_meta($post->ID, 'rf_description', true));
            break;
        case "product_id":
            echo esc_html(get_post_meta($post->ID, 'rf_product_id', true));
            break;
        case "usage_limit":
            echo esc_html(get_post_meta($post->ID, 'rf_usage', true) . ' / ' . get_post_meta($post->ID, 'rf_limit', true));
            break;
        case "expiry_date":
            echo esc_html(get_post_meta($post->ID, 'rf_expiry_date', true));
            break;
        case "type":
            echo esc_html(get_post_meta($post->ID, 'rf_type', true) == 1 ? 'Refered by email' : 'Refered by share link');
            break;
    }
}
开发者ID:javolero,项目名称:dabba,代码行数:32,代码来源:referfriend-columns.php

示例2: render_shop_coupon_columns

 /**
  * Output custom columns for coupons
  *
  * @param string $column
  */
 public function render_shop_coupon_columns($column)
 {
     global $post, $woocommerce;
     switch ($column) {
         case 'coupon_code':
             $edit_link = get_edit_post_link($post->ID);
             $title = _draft_or_post_title();
             echo '<strong><a href="' . esc_attr($edit_link) . '" class="row-title">' . esc_html($title) . '</a></strong>';
             _post_states($post);
             $this->_render_shop_coupon_row_actions($post, $title);
             break;
         case 'type':
             echo esc_html(wc_get_coupon_type(get_post_meta($post->ID, 'discount_type', true)));
             break;
         case 'amount':
             echo esc_html(get_post_meta($post->ID, 'coupon_amount', true));
             break;
         case 'products':
             $product_ids = get_post_meta($post->ID, 'product_ids', true);
             $product_ids = $product_ids ? array_map('absint', explode(',', $product_ids)) : array();
             if (sizeof($product_ids) > 0) {
                 echo esc_html(implode(', ', $product_ids));
             } else {
                 echo '&ndash;';
             }
             break;
         case 'usage_limit':
             $usage_limit = get_post_meta($post->ID, 'usage_limit', true);
             if ($usage_limit) {
                 echo esc_html($usage_limit);
             } else {
                 echo '&ndash;';
             }
             break;
         case 'usage':
             $usage_count = absint(get_post_meta($post->ID, 'usage_count', true));
             $usage_limit = esc_html(get_post_meta($post->ID, 'usage_limit', true));
             $usage_url = sprintf('<a href="%s">%s</a>', admin_url(sprintf('edit.php?s=%s&post_status=all&post_type=shop_order', esc_html($post->post_title))), $usage_count);
             if ($usage_limit) {
                 printf(__('%s / %s', 'woocommerce'), $usage_url, $usage_limit);
             } else {
                 printf(__('%s / &infin;', 'woocommerce'), $usage_url);
             }
             break;
         case 'expiry_date':
             $expiry_date = get_post_meta($post->ID, 'expiry_date', true);
             if ($expiry_date) {
                 echo esc_html(date_i18n('F j, Y', strtotime($expiry_date)));
             } else {
                 echo '&ndash;';
             }
             break;
         case 'description':
             echo wp_kses_post($post->post_excerpt);
             break;
     }
 }
开发者ID:vkolova,项目名称:bgscena,代码行数:62,代码来源:class-wc-admin-post-types.php

示例3: render_shop_coupon_columns

 /**
  * Output custom columns for coupons
  * @param  string $column
  */
 public function render_shop_coupon_columns($column)
 {
     global $post, $woocommerce;
     switch ($column) {
         case 'coupon_code':
             $edit_link = get_edit_post_link($post->ID);
             $title = _draft_or_post_title();
             $post_type_object = get_post_type_object($post->post_type);
             echo '<a href="' . esc_attr($edit_link) . '">' . esc_html($title) . '</a>';
             _post_states($post);
             // Get actions
             $actions = array();
             if (current_user_can($post_type_object->cap->edit_post, $post->ID)) {
                 $actions['edit'] = '<a href="' . admin_url(sprintf($post_type_object->_edit_link . '&amp;action=edit', $post->ID)) . '">' . __('Edit', 'woocommerce') . '</a>';
             }
             if (current_user_can($post_type_object->cap->delete_post, $post->ID)) {
                 if ('trash' == $post->post_status) {
                     $actions['untrash'] = "<a title='" . esc_attr(__('Restore this item from the Trash', 'woocommerce')) . "' href='" . wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&amp;action=untrash', $post->ID)), 'untrash-post_' . $post->ID) . "'>" . __('Restore', 'woocommerce') . "</a>";
                 } elseif (EMPTY_TRASH_DAYS) {
                     $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this item to the Trash', 'woocommerce')) . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash', 'woocommerce') . "</a>";
                 }
                 if ('trash' == $post->post_status || !EMPTY_TRASH_DAYS) {
                     $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this item permanently', 'woocommerce')) . "' href='" . get_delete_post_link($post->ID, '', true) . "'>" . __('Delete Permanently', 'woocommerce') . "</a>";
                 }
             }
             $actions = apply_filters('post_row_actions', $actions, $post);
             echo '<div class="row-actions">';
             $i = 0;
             $action_count = sizeof($actions);
             foreach ($actions as $action => $link) {
                 ++$i;
                 $i == $action_count ? $sep = '' : ($sep = ' | ');
                 echo "<span class='{$action}'>{$link}{$sep}</span>";
             }
             echo '</div>';
             break;
         case 'type':
             echo esc_html(wc_get_coupon_type(get_post_meta($post->ID, 'discount_type', true)));
             break;
         case 'amount':
             echo esc_html(get_post_meta($post->ID, 'coupon_amount', true));
             break;
         case 'products':
             $product_ids = get_post_meta($post->ID, 'product_ids', true);
             $product_ids = $product_ids ? array_map('absint', explode(',', $product_ids)) : array();
             if (sizeof($product_ids) > 0) {
                 echo esc_html(implode(', ', $product_ids));
             } else {
                 echo '&ndash;';
             }
             break;
         case 'usage_limit':
             $usage_limit = get_post_meta($post->ID, 'usage_limit', true);
             if ($usage_limit) {
                 echo esc_html($usage_limit);
             } else {
                 echo '&ndash;';
             }
             break;
         case 'usage':
             $usage_count = absint(get_post_meta($post->ID, 'usage_count', true));
             $usage_limit = esc_html(get_post_meta($post->ID, 'usage_limit', true));
             $usage_url = sprintf('<a href="%s">%s</a>', admin_url(sprintf('edit.php?s=%s&post_status=all&post_type=shop_order', esc_html($post->post_title))), $usage_count);
             if ($usage_limit) {
                 printf(__('%s / %s', 'woocommerce'), $usage_url, $usage_limit);
             } else {
                 printf(__('%s / &infin;', 'woocommerce'), $usage_url);
             }
             break;
         case 'expiry_date':
             $expiry_date = get_post_meta($post->ID, 'expiry_date', true);
             if ($expiry_date) {
                 echo esc_html(date_i18n('F j, Y', strtotime($expiry_date)));
             } else {
                 echo '&ndash;';
             }
             break;
         case 'description':
             echo wp_kses_post($post->post_excerpt);
             break;
     }
 }
开发者ID:mathewdenis,项目名称:avada,代码行数:86,代码来源:class-wc-admin-post-types.php

示例4: test_wc_get_coupon_type

 /**
  * Test wc_get_coupon_type().
  *
  * @since 2.2
  */
 public function test_wc_get_coupon_type()
 {
     $this->assertEquals('Cart Discount', wc_get_coupon_type('fixed_cart'));
     $this->assertEmpty(wc_get_coupon_type('bogus_type'));
 }
开发者ID:bitoncoin,项目名称:woocommerce,代码行数:10,代码来源:functions.php

示例5: get_coupon_discount_type

 /**
  * @deprecated 2.1.0
  * @param string $type
  * @return string
  */
 public function get_coupon_discount_type($type = '')
 {
     _deprecated_function('Woocommerce->get_coupon_discount_type', '2.1', 'wc_get_coupon_type');
     return wc_get_coupon_type($type);
 }
开发者ID:donwea,项目名称:nhap.org,代码行数:10,代码来源:woocommerce.php

示例6: get_discount_type

 /**
  * Backwards compatible method of getting a discount type
  *
  * @param string $type
  * @return string
  */
 public static function get_discount_type($type)
 {
     return function_exists('wc_get_coupon_type') ? wc_get_coupon_type($type) : WC()->get_coupon_discount_type($type);
 }
开发者ID:bself,项目名称:nuimage-wp,代码行数:10,代码来源:class-fue-coupons.php

示例7: get_discount_type

 public static function get_discount_type($type)
 {
     global $woocommerce;
     return function_exists('wc_get_coupon_type') ? wc_get_coupon_type($type) : $woocommerce->get_coupon_discount_type($type);
 }
开发者ID:jgabrielfreitas,项目名称:MultipagosTestesAPP,代码行数:5,代码来源:class.fue_coupons.php


注:本文中的wc_get_coupon_type函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。