'Color', 'sizes' => 'Sizes', 'city' => 'City', 'euvendor' => 'EuVendor', 'gender' => 'Gender', 'hand-sanitizers' => 'Hand Sanitizers', 'item' => 'Item', 'jewel' => 'Jewel', 'length' => 'Length', 'occasion' => 'Occasion', 'salwar-suits' => 'Salwar Suits', 'seller-information' => 'Seller Information', 'state' => 'State', ]; return array_merge( $types, $custom_types );}//add_filter( 'product_attributes_type_selector', 'chint_add_custom_attribute_types' );add_filter( 'woocommerce_product_attributes_type_selector', 'chint_add_custom_attribute_types' );add_action( 'current_screen', function() { $screen = get_current_screen(); //error_log( 'Current Screen ID: ' . $screen->id ); if ( $screen->id === 'product_page_product_attributes' ) { // Attributes screen: Add 'type' selector add_filter( 'product_attributes_type_selector', 'chint_add_custom_attribute_types' ); } if ( $screen->id === 'product' ) { // Product add/edit screen: Show attribute types in product editor add_filter( 'woocommerce_product_attributes_type_selector', 'chint_add_custom_attribute_types' ); }});// 2. Update dropdown label text via admin footer (safe way to output script)add_action( 'admin_footer', function () { echo '';});// 3. Replace dropdowns with swatches on single product pagesadd_filter( 'woocommerce_dropdown_variation_attribute_options_html', function( $html, $args ) { global $wpdb; $taxonomy = $args['attribute']; $product = $args['product']; $attribute_type = $wpdb->get_var( $wpdb->prepare( "SELECT attribute_type FROM {$wpdb->prefix}woocommerce_attribute_taxonomies WHERE attribute_name = %s", substr( $taxonomy, 3 ) )); if ( ! in_array( $attribute_type, ['color', 'sizes', 'city', 'euvendor', 'gender', 'hand-sanitizers', 'item', 'jewel', 'length', 'occasion', 'salwar-suits', 'seller-information', 'state'], true ) ) return $html; $html = '
' . $html . '
'; $terms = wc_get_product_terms( $product->get_id(), $taxonomy, [ 'fields' => 'all' ] ); foreach ( $terms as $term ) { if ( in_array( $term->slug, $args['options'], true ) ) { $selected = $args['selected'] === $term->slug ? ' selected' : ''; if ( $attribute_type === 'color' ) { $hex_color = get_term_meta( $term->term_id, 'color_hex', true );// If no saved meta, fallback to hardcoded hex valuesif ( ! $hex_color ) { $hardcoded_colors = [ 'amaranth' => '#E52B50', 'amber' => '#FFBF00', 'amethyst' => '#9966CC', 'apricot' => '#FBCEB1', 'aquamarine' => '#7FFFD4', 'azure' => '#007FFF', 'baby-pink' => '#F4C2C2', 'baby-blue' => '#89CFF0', 'beige' => '#F5F5DC', 'black' => '#000000', 'black-white' => '#2F2F2F', 'blue' => '#0000FF', 'blue-green' => '#0D98BA', 'blue-grey' => '#6699CC', 'blue-violet' => '#8A2BE2', 'blue-white' => '#D6EFFF', 'blush' => '#DE5D83', 'brick-red' => '#CB4154', 'bronze' => '#CD7F32', 'brown' => '#8B4513', 'burgundy' => '#800020', 'byzantium' => '#702963', 'carmine' => '#960018', 'cerise' => '#DE3163', 'cerulean' => '#007BA7', 'champagne' => '#F7E7CE', 'chartreuse-green' => '#7FFF00', 'chocolate' => '#7B3F00', 'cobalt-blue' => '#0047AB', 'coffee' => '#6F4E37', 'coffee-brown' => '#4B3621', 'copper' => '#B87333', 'coral' => '#FF7F50', 'cream' => '#FFFDD0', 'cream-green' => '#D5ECC2', 'cream-pink' => '#FEE3EC', 'crimson' => '#DC143C', 'cyan' => '#00FFFF', 'dark-blue' => '#00008B', 'dark-peach' => '#DE7E5D', 'desert-sand' => '#EDC9AF', 'electric-blue' => '#7DF9FF', 'emerald' => '#50C878', 'erin' => '#00FF40', 'fluorescent-green' => '#39FF14', 'gey-blue' => '#72A0C1', 'gold' => '#FFD700', 'golden-brown' => '#996515', 'golden-yellow' => '#FFDF00', 'gray' => '#808080', 'grayish-blue' => '#5E7C8A', 'green' => '#008000', 'grey' => '#808080', 'grey-blue' => '#6699CC', 'grey-yellow' => '#E5E4B1', 'greyish-blue' => '#A9B0B3', 'harlequin' => '#3FFF00', 'hina-green' => '#608341', 'indigo' => '#4B0082', 'indigo-blue' => '#3F00FF', 'ivory' => '#FFFFF0', 'jade' => '#00A86B', 'jungle-green' => '#29AB87', 'lavender' => '#E6E6FA', 'lemon' => '#FFF700', 'lemon-yellow' => '#FFF44F', 'light-blue' => '#ADD8E6', 'light-brown' => '#B5651D', 'light-green' => '#90EE90', 'light-grey' => '#D3D3D3', 'light-peach' => '#FFDAB9', 'lilac' => '#C8A2C8', 'lime' => '#00FF00', 'magenta' => '#FF00FF', 'magenta-rose' => '#FF66CC', 'maroon' => '#800000', 'mauve' => '#E0B0FF', 'mehandi' => '#5C552E', 'mustard' => '#FFDB58', 'mustard-yellow' => '#E1AD01', 'musturd-yellow' => '#E1AD01', 'navy-blue' => '#000080', 'ochre' => '#CC7722', 'off-white' => '#FAF9F6', 'olive' => '#808000', 'olive-green' => '#556B2F', 'orange' => '#FFA500', 'orange-red' => '#FF4500', 'orchid' => '#DA70D6', 'peach' => '#FFE5B4', 'pear' => '#D1E231', 'periwinkle' => '#CCCCFF', 'persian-blue' => '#1C39BB', 'pink' => '#FFC0CB', 'plum' => '#8E4585', 'prussian-blue' => '#003153', 'puce' => '#A95C68', 'purple' => '#800080', 'rama-green' => '#30D5C8', 'raspberry' => '#E30B5C', 'red' => '#FF0000', 'red-violet' => '#C71585', 'rose' => '#FF007F', 'ruby' => '#E0115F', 'rust' => '#B7410E', 'salmon' => '#FA8072', 'sangria' => '#92000A', 'sapphire' => '#0F52BA', 'scarlet' => '#FF2400', 'sea-green' => '#2E8B57', 'silver' => '#C0C0C0', 'silver-white' => '#F1F1F1', 'sky-blue' => '#87CEEB', 'slate' => '#708090', 'slate-gray' => '#708090', 'spring-bud' => '#A7FC00', 'spring-green' => '#00FF7F', 'tan' => '#D2B48C', 'taupe' => '#483C32', 'teal' => '#008080', 'turquoise' => '#40E0D0', 'ultramarine' => '#3F00FF', 'violet' => '#EE82EE', 'viridian' => '#40826D', 'white' => '#FFFFFF', 'white-blue' => '#E8F8FF', 'yellow' => '#FFFF00', 'yellow-green' => '#9ACD32' ]; $term_slug = $term->slug; if ( isset( $hardcoded_colors[ $term_slug ] ) ) { $hex_color = $hardcoded_colors[ $term_slug ]; } else { $hex_color = '#ccc'; // Fallback }} $html .= sprintf( '', esc_attr( $selected ), esc_attr( $hex_color ), esc_attr( $term->name ), esc_attr( $term->slug ) ); } else { $html .= sprintf( '%3$s', esc_attr( $selected ), esc_attr( $term->slug ), esc_html( $term->name ) ); } } } return $html;}, 20, 2);// 4. Swatch styles and scriptsadd_action( 'wp_enqueue_scripts', function() { wp_enqueue_style( 'woo-swatches-css', plugin_dir_url( __FILE__ ) . 'css/woo-swatches.css', [], '1.0' ); if ( is_product() ) { wp_enqueue_script( 'custom-variation-swatches', plugin_dir_url( __FILE__ ) . 'js/variation-swatches.js', ['jquery'], '1.0', true ); }}, 20);// 5. Restrict custom attributes visibility in adminadd_action('admin_head', function() { $screen = get_current_screen(); if ( $screen && $screen->id === 'product' ) { echo ''; }});// Additional admin attribute validation (optional, commented out for now)// add_action('woocommerce_admin_process_product_object', function($product) {// $attributes = $product->get_attributes();// foreach ($attributes as $taxonomy => $attribute) {// if ($attribute instanceof WC_Product_Attribute) {// $count = count($attribute->get_options());// if (in_array($taxonomy, ['pa_colors', 'pa_sizes']) && $count > 10) {// wc_add_notice("You can only select up to 10 terms for $taxonomy", 'error');// } elseif (!in_array($taxonomy, ['pa_colors', 'pa_sizes']) && $count > 5) {// wc_add_notice("You can only select up to 5 terms for $taxonomy", 'error');// }// }// }// });add_action( 'woocommerce_single_product_summary', 'chint_render_attribute_swatches_for_simple_grouped', 20 );function chint_render_attribute_swatches_for_simple_grouped() { global $product; // Only render for Simple or Grouped if ( ! $product || ! in_array( $product->get_type(), [ 'simple', 'grouped' ], true ) ) { return; } $attributes = $product->get_attributes(); foreach ( $attributes as $attribute ) { if ( $attribute->is_taxonomy() ) { $taxonomy = $attribute->get_name(); $attribute_name = wc_attribute_label( $taxonomy ); $terms = wc_get_product_terms( $product->get_id(), $taxonomy, [ 'fields' => 'all' ] ); $taxonomy_slug = substr( $taxonomy, 3 ); // remove "pa_" $attribute_type = get_attribute_type( $taxonomy_slug ); // custom function if ( ! $attribute_type || empty( $terms ) ) continue; echo ''; echo '' . esc_html( $attribute_name ) . ': '; foreach ( $terms as $term ) { $value = esc_attr( $term->slug ); $label = esc_html( $term->name ); if ( $attribute_type === 'color' ) { $hex = get_term_meta( $term->term_id, 'color_hex', true ) ?: '#ccc'; echo ""; } else { echo "{$label}"; } } echo '
'; } }}// Helper function to get attribute typefunction get_attribute_type( $attribute_name ) { global $wpdb; return $wpdb->get_var( $wpdb->prepare( "SELECT attribute_type FROM {$wpdb->prefix}woocommerce_attribute_taxonomies WHERE attribute_name = %s", $attribute_name ));}
cotton – Shreemati
Showing 1–12 of 93 results
-

Kurtas cotton black Divena
₹1,424 – ₹1,574
Add to cart
This product has multiple variants. The options may be chosen on the product page
-

Kurtas cotton black Divena
₹1,799 – ₹1,949
Add to cart
This product has multiple variants. The options may be chosen on the product page
-

Kurtas cotton red Divena
₹1,343 – ₹1,349
Add to cart
This product has multiple variants. The options may be chosen on the product page
-

Kurtas cotton black Divena
₹1,949 – ₹2,099
Add to cart
This product has multiple variants. The options may be chosen on the product page
-

Kurtas cotton rama-green Divena
₹2,249 – ₹2,399
Add to cart
This product has multiple variants. The options may be chosen on the product page
-

Kurtas cotton peach Divena
₹1,422 – ₹1,424
Add to cart
This product has multiple variants. The options may be chosen on the product page
-

Kurtas cotton blue Divena
₹1,347 – ₹1,349
Add to cart
This product has multiple variants. The options may be chosen on the product page
-

Kurtas cotton grey Divena
₹1,424 – ₹1,874
Add to cart
This product has multiple variants. The options may be chosen on the product page
-

Kurtas cotton light-grey Divena
₹2,699 – ₹2,849
Add to cart
This product has multiple variants. The options may be chosen on the product page
-

Kurtas cotton white Divena
₹2,999 – ₹3,299
Add to cart
This product has multiple variants. The options may be chosen on the product page
-

Kurtas cotton yellow Divena
₹3,299 – ₹3,599
Add to cart
This product has multiple variants. The options may be chosen on the product page
-

Kurtas cotton cream Divena
₹1,418 – ₹1,424
Add to cart
This product has multiple variants. The options may be chosen on the product page
Showing 1–12 of 93 results