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
/** | |
* Declare that your theme now supports Sensei | |
*/ | |
add_action( 'after_setup_theme', 'sensei_support' ); | |
function sensei_support() { | |
add_theme_support( 'sensei' ); | |
} | |
/** | |
* Remove the default Sensei wrappers |
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
/** | |
* Declare Sensei support | |
* | |
* This is needed to hide the Sensei theme compatibility notice your admin dashboard. | |
*/ | |
add_action( 'after_setup_theme', 'divi_sensei_support' ); | |
function divi_sensei_support() { | |
add_theme_support( 'sensei' ); | |
} |
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_admin_order_item_headers', 'wc_msrp_headers' ); | |
function wc_msrp_headers() { | |
?><th class="item_msrp sortable"><?php _e( 'MSRP', 'woocommerce' ); ?></th><?php | |
} | |
add_action( 'woocommerce_admin_order_item_values', 'wc_msrp_order_item_values' ); | |
function wc_msrp_order_item_values( $_product ) { | |
$msrp = get_post_meta( absint( $_product->id ), '_msrp_price', true ); | |
printf( '<td class="item_msrp">%s</td>', ( $msrp ? wc_price( $msrp ) : '-' ) ); | |
} |
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_admin_order_item_headers', 'wc_msrp_headers' ); | |
function wc_msrp_headers() { | |
?><th class="item_msrp sortable"><?php _e( 'MSRP', 'woocommerce' ); ?></th><?php | |
} | |
add_action( 'woocommerce_admin_order_item_values', 'wc_msrp_order_item_values' ); | |
function wc_msrp_order_item_values( $_product ) { | |
$msrp = get_post_meta( absint( $_product->id ), '_msrp_price', true ); | |
printf( '<td class="item_msrp">%s</td>', wc_price( $msrp ) ); | |
} |
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_add_to_cart_redirect', 'wc_custom_cart_redirect' ); | |
function wc_custom_cart_redirect() { | |
return get_permalink( wc_get_page_id( 'shop' ) ); | |
} |
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
/** | |
* Changes the redirect URL for the Return To Shop button in the cart. | |
* | |
* @return string | |
*/ | |
function wc_empty_cart_redirect_url() { | |
return 'http://yourdomain.com/your-page/'; | |
} | |
add_filter( 'woocommerce_return_to_shop_redirect', 'wc_empty_cart_redirect_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
add_action( 'wc_custom_thankyou_failed', 'wc_custom_thankyou_failed', 10 ); | |
function wc_custom_thankyou_failed( $order ) { | |
wc_get_template( 'custom-thankyou/failed.php', array( 'order' => $order ) ); | |
} | |
add_action( 'wc_custom_thankyou_successful', 'wc_custom_thankyou_header', 10 ); | |
function wc_custom_thankyou_header( $order ) { | |
wc_get_template( 'custom-thankyou/header.php', array( 'order' => $order ) ); | |
} |
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( 'the_content', 'wc_custom_thankyou' ); | |
function wc_custom_thankyou( $content ) { | |
// Check if is the correct page | |
if ( ! is_page( {PAGE_ID} ) ) { | |
return $content; | |
} | |
// check if the order ID exists | |
if ( ! isset( $_GET['key'] ) || ! isset( $_GET['order'] ) ) { | |
return $content; |
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( 'template_redirect', 'wc_custom_redirect_after_purchase' ); | |
function wc_custom_redirect_after_purchase() { | |
global $wp; | |
if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) { | |
$order_id = absint( $wp->query_vars['order-received'] ); | |
$order_key = wc_clean( $_GET['key'] ); | |
$redirect = get_permalink( {PAGE_ID} ); | |
$redirect .= get_option( 'permalink_structure' ) === '' ? '&' : '?'; |
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 cost for free checkout add-ons | |
* | |
* @param string $html | |
* @param object $fee | |
* @return string | |
*/ | |
function wc_hide_fee_cost( $html, $fee ) { | |
$hide_for = array( | |
'add-on-slug', |