# timetics/1.0.13/templates/woocommerce/coupon-restriction-option.php

Timetics – Appointment Booking Calendar &amp; Scheduling, version 1.0.13. 38 lines.

- Page: https://pluginprobe.com/plugins/timetics/1.0.13/code/templates/woocommerce/coupon-restriction-option.php
- Raw: https://pluginprobe.com/plugins/timetics/1.0.13/raw/templates/woocommerce/coupon-restriction-option.php
- Modified: 2023-11-05T06:29:24+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/timetics/1.0.13/code/templates/woocommerce/coupon-restriction-option.php#L10-L20`.

```php
<?php
/**
 * WooCommerce Coupon Restriction Option Template
 *
 * @package Timetics
 */

$selected_ids = get_post_meta( $coupon_id, 'timetics_meeting_ids', true );
$selected_ids = ! empty( $selected_ids ) ? $selected_ids : [];

?>
<p class="form-field">
    <label><?php _e( 'Timetics Meetings', 'timetics' ); ?></label>
    <select class="timetics-product-search" multiple="multiple" style="width: 50%;" name="timetics_meeting_ids[]" data-placeholder="<?php esc_attr_e( 'Search for a product&hellip;', 'timetics' ); ?>">
        <?php
        $args = array(
            'status' => 'publish',
            'limit' => -1,
            'category' => array( 'timetics-meeting' ),
        );
        $products = wc_get_products( $args );

        foreach ( $products as $product ) {
            $selected = in_array( $product->get_id(), $selected_ids );
            if ( is_object( $product ) ) {
                echo '<option value="' . esc_attr( $product->get_id() ) . '"' . selected( $selected, true, false ) . '>' . esc_html( wp_strip_all_tags( $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.', 'timetics' ) ); ?>
</p>
<script>
    jQuery(function($) {
        $('.timetics-product-search').select2();
    });
</script>

```
