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 | |
add_filter( 'woocommerce_product_tabs', 'remove_product_tabs', 20 ); | |
function remove_product_tabs( $tabs ) { | |
unset( $tabs['description'] ); // Remove the description tab | |
unset( $tabs['reviews'] ); // Remove the reviews tab | |
unset( $tabs['additional_information'] ); // Remove the additional information tab | |
return $tabs; | |
} |
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 | |
add_filter( 'body_class', 'membership_body_class' ); | |
function membership_body_class( $classes ) { | |
if ( ! function_exists( 'wc_memberships' ) ) { | |
return $classes; | |
} | |
$user_id = get_current_user_id(); | |
$args = array( |
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 | |
function customer_has_download( $product_id ) { | |
$has_download = false; | |
$user_id = get_current_user_id(); | |
if ( $user_id ) { | |
$downloads = wc_get_customer_available_downloads( $user_id ); | |
if ( ! empty($downloads) ) { | |
foreach ($downloads as $download) { |
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 | |
function get_year_group_upsells() { | |
$user_id = get_current_user_id(); | |
$args = array( | |
'status' => array( 'active', 'pending-cancellation' ), // Add or remove other statuses if you want | |
); | |
// Get user memberships | |
$active_memberships = wc_memberships_get_user_memberships( $user_id, $args ); |
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 | |
// This function sorts the product based on menu order. You can get other numerical conditions here: https://www.businessbloomer.com/woocommerce-easily-get-product-info-title-sku-desc-product-object/#more-72711 | |
function product_multiarray_sort( $productIDsArray ) { | |
$productMultiArray = array(); | |
$sortedProductIDsArray = array(); | |
foreach ( $productIDsArray as $productID ) { | |
$product = wc_get_product( $productID ); |
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 | |
add_action( 'woocommerce_account_downloads_column_download-product', 'custom_account_downloads_product_name' ); | |
function custom_account_downloads_product_name( $download ){ | |
echo esc_html( $download['product_name'] ); | |
} | |
?> |
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 | |
function has_woocommerce_subscription($the_user_id, $the_product_id, $the_status) { | |
if ( empty($the_user_id) ) { | |
$the_user_id = get_current_user_id(); | |
} | |
if (wcs_user_has_subscription( $the_user_id, $the_product_id, $the_status)) { | |
return true; | |
} | |
} |
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 | |
// Shortcode example: [display_subcats id="55"]. Replace 55 with your parent category ID | |
add_shortcode('display_subcats', 'display_subcats'); | |
function display_subcats( $atts, $content = null ) { | |
$atts = shortcode_atts( | |
array( | |
'id' => '' |