This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_available_variation', 'unset_variation_attribute', 10, 3 ); | |
function unset_variation_attribute( $data, $product, $variation ) { | |
// Define the attribute name you want to hide (e.g., "Size") | |
$attribute_to_hide = 'Size'; | |
// Unset the attribute if it exists in the variation data | |
if (isset($data['attributes']['attribute_' . sanitize_title($attribute_to_hide)])) { | |
unset($data['attributes']['attribute_' . sanitize_title($attribute_to_hide)]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
&& in_array( 'administrator', (array) $user->roles ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_before_single_product_summary', 'hook_field' ); | |
function hook_field() { | |
if ( is_product() and is_single('15412') ) { | |
echo get_post_meta( get_the_ID(), 'product_field', true ); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$message_one = 'Message 1'; | |
$message_two = 'Message 2'; | |
$custom_message = has_term( 'demo', 'product_cat' ) ? $message_one : $message_two; | |
return $custom_message; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( has_term( 'demo', 'product_cat' ) ) | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('woocommerce_after_shop_loop_item_title', 'hook_cat_link'); | |
function hook_cat_link() { | |
global $product; | |
echo wc_get_product_category_list( $product->get_id(), ', ', '<span class="posted_in">' . _n( '', '', count( $product->get_category_ids() ), 'woocommerce' ) . ' ', '</span>' ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$result = $customer || current_user_can('administrator') ? the_content() : $not_customer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
$('a.woocommerce-product-gallery__trigger').click(function(){ | |
window.open(this.href); | |
return false; | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function filter_upsells_product_display( $args ) { | |
$args['orderby'] = 'title'; | |
$args['order'] = 'ASC'; | |
return $args; | |
} | |
add_filter( 'woocommerce_upsell_display_args', 'filter_upsells_product_display', 20 ); |