View functions.php
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_countries_allowed_countries', 'wc_ban_russia' ); | |
function wc_ban_russia( $countries ) { | |
if ( isset( $countries['RU'] ) ) { | |
unset( $countries['RU'] ); | |
} | |
return $countries; | |
} |
View functions.php
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_get_price_html', 'wc_edit_bookable_remove_from_price', 10, 2 ); | |
function wc_edit_bookable_remove_from_price( $html, $product ) { | |
if ( ! $product->is_type( 'booking' ) ) { | |
return $html; | |
} | |
return str_replace( 'From: ', '', $html ); | |
} |
View short-description-on-shop-page.php
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
/** | |
* Plugin Name: Show Short Description on the Shop Page | |
* Plugin URI: https://nicolamustone.blog/2016/12/01/show-products-short-description-shop-page/#comment-2119 | |
* Description: Shows the product's short description on the shop page with WooCommerce. | |
* Version: 1.0 | |
* Author: Nicola Mustone | |
* Author URI: https://nicolamustone.blog | |
*/ | |
add_action( 'woocommerce_after_shop_loop_item', 'woo_show_excerpt_shop_page', 5 ); |
View functions.php
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 the Confirm Email Address field to the Billing chekcout form | |
*/ | |
add_filter( 'woocommerce_checkout_fields' , 'wc_custom_add_email_confirm_field_checkout' ); | |
function wc_custom_add_email_confirm_field_checkout( $fields ) { | |
$fields['billing']['billing_email_confirm'] = array( | |
'label' => __( 'Confirm Email Address', 'domain' ), | |
'required' => true, | |
'class' => array( 'form-row-wide' ), | |
'priority' => 120, |
View functions.php
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_email_subject_low_stock', 'wc_custom_low_stock_subject', 20, 2 ); | |
function wc_custom_low_stock_subject( $subject, $product ) { | |
return str_replace( 'Product', $product->get_name(), $subject ) . sprintf( __( ' - only %d left', 'domain' ), $product->get_stock_quantity() ); | |
} |
View functions.php
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_email_subject_low_stock', 'wc_custom_low_stock_subject', 20, 2 ); | |
function wc_custom_low_stock_subject( $subject, $product ) { | |
return str_replace( 'Product', $product->get_name(), $subject ); | |
} |
View functions.php
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
remove_action( 'woocommerce_after_shop_loop', 'woocommerce_result_count', 20 ); |
View functions.php
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
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); |
View functions.php
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_shortcode( 'price_per_weight', 'wc_custom_per_price_weight' ); | |
function wc_custom_per_price_weight() { | |
global $product; | |
if ( $product ) { | |
$price = $product->get_price(); | |
$weight = $product->get_weight(); | |
$price_kg = $price / $weight; |
View gist:e4ef240a440b6d32aaefd8ae36be28bb
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
echo '<div style="color: #ff0000;">' . $product->post->post_excerpt . '</div>'; |
NewerOlder