Skip to content

Instantly share code, notes, and snippets.

View qzya's full-sized avatar
☦️
kyrieeleisonkyrieeleisonkyrieeleisonkyrieeleisonkyrieeleison

qzya

☦️
kyrieeleisonkyrieeleisonkyrieeleisonkyrieeleisonkyrieeleison
View GitHub Profile
@qzya
qzya / sorting_in_variations_dropdown.php
Created March 30, 2022 22:38
[Sort product attributes in variations dropdown on single page by backend variations order ] #wp #woocommerce #products #product_attributes #sorting #terms #variations
<?php
add_filter('woocommerce_dropdown_variation_attribute_options_html', 'wc_dropdown_variation_attribute_options_sorted', 20, 2);
function wc_dropdown_variation_attribute_options_sorted( $html, $args ) {
$args = wp_parse_args(
apply_filters( 'woocommerce_dropdown_variation_attribute_options_args', $args ),
array(
'options' => false,
'attribute' => false,
'product' => false,