Skip to content

Instantly share code, notes, and snippets.

@ARCHTKT
ARCHTKT / plugged.php
Last active July 3, 2021 07:26
WooCommerce coupon usage restriction by allowed user roles
<?php /* No copiar esta linea */
// Add new field - Coupon usage restriction tab
function archtkt_woocommerce_coupon_options_usage_restriction( $coupon_get_id, $coupon ) {
woocommerce_wp_text_input( array(
'id' => 'customer_user_role',
'label' => __( 'User role restrictions', 'woocommerce' ),
'placeholder' => __( 'No restrictions', 'woocommerce' ),
'description' => __( 'List of allowed user roles. Separate user roles with commas.', 'woocommerce' ),
'desc_tip' => true,