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
/** | |
* Temp Fix for the Bookings issue below. | |
* #3459 | |
*/ | |
function temp_price_fix_bookings( $price, $product ) { | |
$target_product_types = array( | |
'booking' | |
); |
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 change_booking_single_add_to_cart_text() { | |
echo 'Changed Text'; | |
} | |
add_filter( 'woocommerce_booking_single_add_to_cart_text','change_booking_single_add_to_cart_text' ); |
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
/** | |
* Temporary fix for Composite Products Sort by newness to Sort by latest text | |
*/ | |
function temp_order_by_text_tweak( $orderby_options ) { | |
$orderby_options['date'] = __( 'Sort by latest', 'woocommerce' ); | |
return $orderby_options; |
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 sf_output_custom_shortcode_section() { | |
echo '<section class="storefront-product-section storefront-product-category">'; | |
echo '<h2 class="section-title">' . __( 'Music Category', 'storefront' ) . '</h2>'; | |
echo do_shortcode( '[product_category category="music" columns="4" per_page="4"]' ); | |
echo '</section>'; |
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 translate_text( $translated ) { | |
// The first parameter is the original text, the second parameter is the changed text. | |
$translated = str_ireplace( 'Choose and option', 'Select', $translated ); | |
// Returns the translated text | |
return $translated; | |
} | |
add_filter( 'gettext', 'translate_text' ); |
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 WooCommerce product category image full width under the header of the Storefront theme. | |
*/ | |
function woocommerce_category_image() { | |
if ( is_product_category() ){ | |
global $wp_query; | |
$cat = $wp_query->get_queried_object(); | |
$thumbnail_id = get_term_meta( $cat->term_id, 'thumbnail_id', true ); | |
$image = wp_get_attachment_url( $thumbnail_id ); |
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 custom_pre_get_posts_query( $q ) { | |
$tax_query = (array) $q->get( 'tax_query' ); | |
$tax_query[] = array( | |
'taxonomy' => 'product_cat', | |
'field' => 'slug', | |
'terms' => array( 'clothing' ), // Don't display products in the clothing category on the shop page. | |
'operator' => 'NOT IN' | |
); |
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_product_add_to_cart_text', function( $text ) { | |
global $product; | |
if ( $product->is_type( 'composite' ) ) { | |
$text = $product->is_purchasable() ? __( 'Custom options text', 'woocommerce' ) : __( 'Read more', 'woocommerce' ); | |
} | |
return $text; | |
}, 10 ); |
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
/** | |
* Alters the output of the homepage product categories on the Storefront theme | |
* Affects the storefront_product_categories_args filter in /inc/structure/template-tags.php | |
*/ | |
function sd_display_four_home_product_categories( $args ) { | |
// Sets the maximum product categories to 4, you can increase this to display more if need be. | |
$args['limit'] = 4; | |