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 the Confirm Email Address field to the Billing checkout 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' ), |
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_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() ); | |
} |
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_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 ); | |
} |
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 | |
remove_action( 'woocommerce_after_shop_loop', 'woocommerce_result_count', 20 ); |
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 | |
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); |
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_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; |
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
echo '<div style="color: #ff0000;">' . $product->post->post_excerpt . '</div>'; |
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_continue_shopping_redirect', 'custom_continue_shopping_redirect' ); | |
function custom_continue_shopping_redirect( $default ) { | |
//return home_url(); // Redirects to the Home page | |
//return wc_get_page_permalink( 'shop' ); // Redirects to the Shop page | |
//return get_permalink( get_option( 'page_for_posts' ) ); // Redirects to the Blog page | |
//return get_permalink( PAGE_ID ); // Redirects to the specific page by ID (Replace PAGE_ID with your ID | |
return $default; // Return to the default WooCommerce page | |
} |
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_continue_shopping_redirect', function() { return get_home_url(); } ); |
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_get_availability_text', 'price_out_of_stock_string', 10, 2 ); | |
function price_out_of_stock_string( $text, $product ) { | |
if ( $text === 'Out of stock' && $product->get_price() < 100 ) { | |
return "Out of stock because of The Queen's Gambit"; | |
} | |
return $text; | |
} |