This file contains hidden or 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_no_products_found', 'show_products_on_no_products_found', 20 ); | |
function show_products_on_no_products_found() { | |
echo '<h2>' . __( 'You may be interested in...', 'domain' ) . '</h2>'; | |
echo do_shortcode( '[recent_products per_page="4"]' ); | |
} |
This file contains hidden or 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
/** | |
* Checks if the customer is a reseller and | |
* returns false if they are trying to purchase from a specific category. | |
* | |
* @param bool $is_purchasable If the product is purchasable or not. | |
* @return bool | |
*/ | |
function limit_purchases_by_role( $is_purchasable, $product ) { | |
$categories = $product->get_category_ids(); |
This file contains hidden or 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
<?php | |
/** | |
* Load a custom template for vendor taxonomy | |
*/ | |
function load_custom_vendor_template( $located, $template_name ) { | |
if( is_tax( WC_PRODUCT_VENDORS_TAXONOMY ) && 'archive-product.php' == $template_name ) { | |
return get_stylesheet_directory() . '/woocommerce/taxonomy-shop_vendor.php'; | |
} | |
return $located; |
This file contains hidden or 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 wc_ninja_remove_password_strength() { | |
if ( wp_script_is( 'wc-password-strength-meter', 'enqueued' ) ) { | |
wp_dequeue_script( 'wc-password-strength-meter' ); | |
} | |
} | |
add_action( 'wp_print_scripts', 'wc_ninja_remove_password_strength', 100 ); |
This file contains hidden or 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_min_password_strength', create_function( '', 'return 2;' ) ); |
This file contains hidden or 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
/** | |
* Removes the attribute from the product title, in the cart. | |
* | |
* @return string | |
*/ | |
function remove_variation_from_product_title( $title, $cart_item, $cart_item_key ) { | |
$_product = $cart_item['data']; | |
$product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key ); | |
if ( $_product->is_type( 'variation' ) ) { |
This file contains hidden or 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_is_attribute_in_product_name', '__return_false' ); |
This file contains hidden or 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
/** | |
* Hides the product's weight and dimension in the single product page. | |
*/ | |
add_filter( 'wc_product_enable_dimensions_display', '__return_false' ); |
This file contains hidden or 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
// Get current user ID | |
$user_id = get_current_user_id(); | |
// Check if the user is member of the plan 'gold' | |
if ( wc_memberships_is_user_active_member( $user_id, 'gold' ) ) { | |
echo 'This is a special message only for Gold members!'; | |
} else { | |
echo 'I\'m sorry, you are not a gold member. There\'s nothing here for you!'; | |
} |
This file contains hidden or 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
remove_action( 'storefront_footer', 'storefront_handheld_footer_bar', 999 ); |