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
<?php | |
function freeship_get_settings( $settings, $current_section ) { | |
$custom_settings = array(); | |
if( 'free_shipping_notices' == $current_section ) { | |
$custom_settings = array( | |
array( |
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
<?php $present = false; ?> | |
<?php foreach( $order->get_items() as $item ): | |
$_product = wc_get_product( $item['product_id'] ); | |
// Add whatever product id you want below here | |
if ( $item['product_id'] == 643 ): | |
$present = true; ?> | |
<?php endif; endforeach; ?> | |
<?php if( $present ): ?> |
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
<?php | |
add_action( 'woocommerce_thankyou', 'redirect_product_based', 1 ); | |
function redirect_product_based ( $order_id ){ | |
$order = wc_get_order( $order_id ); | |
foreach( $order->get_items() as $item ) { | |
// Add whatever product id you want below here | |
if ( $item['product_id'] == 643 ) { | |
// change below to the URL that you want to send your customer to |
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_action( 'woocommerce_after_cart_totals', 'add_content_on_checkout' ); | |
public function add_content_on_checkout() { | |
echo "<img src='safe_checkout.png' >"; //add the URL of the image | |
} |
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
<?php | |
add_action('woocommerce_before_shop_loop_item', 'ts_before_shop_loop_item' ) ; | |
function ts_before_shop_loop_item() { | |
$product_id = get_the_ID(); | |
$current_date = date( current_time( 'timestamp' ) ); | |
$product_date = get_the_date(); | |
$date_diff = strtotime( $current_date) - strtotime( $product_date ); | |
$number_of_days = $date_diff/ (60*60*24); |
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
<?php | |
add_action( 'woocommerce_before_cart', 'wc_add_notice_free_shipping' ); | |
function wc_add_notice_free_shipping() { | |
$free_shipping_settings = get_option('woocommerce_free_shipping_1_settings'); | |
$amount_for_free_shipping = $free_shipping_settings['min_amount']; | |
$cart = WC()->cart->subtotal; | |
$remaining = $amount_for_free_shipping - $cart; |
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
<?php | |
add_action( 'woocommerce_before_checkout_form', array( &$this, 'wc_add_notice_free_shipping' ) ); | |
function wc_add_notice_free_shipping() { | |
$free_shipping_settings = get_option('woocommerce_free_shipping_1_settings'); | |
$amount_for_free_shipping = $free_shipping_settings['min_amount']; | |
$cart = WC()->cart->subtotal; | |
$remaining = $amount_for_free_shipping - $cart; |
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
<?php | |
add_action( 'woocommerce_order_item_meta_start', 'ts_order_item_meta_start', 10, 4 ); | |
function ts_order_item_meta_start( $item_id, $item, $order, $plain_text ){ | |
echo '<p> Seller: Tyche</p>'; | |
} |
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
<?php | |
add_filter( 'woocommerce_coupons_enabled','ts_hide_coupon_field_on_cart' ); | |
function ts_hide_coupon_field_on_cart( $enabled ) { | |
$product_id = 55; | |
$cart = WC()->cart->get_cart(); | |
foreach ( $cart as $id => $cart_item ) { | |
if( $cart_item[ 'data' ]->get_id() == $product_id ) { | |
return false; |
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
<?php | |
add_action( 'woocommerce_review_order_after_cart_contents', 'ts_review_order_after_cart_contents', 10 ); | |
function ts_review_order_after_cart_contents(){ | |
echo '<h2>woocommerce_review_order_after_cart_contents</h2>'; | |
} |
NewerOlder