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 | |
/** | |
* Copy from here to your (child) themes functions.php | |
* Recommended to do so via FTP. | |
*/ | |
/** | |
* Hide all but the free shipping options when free is available. | |
* |
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 custom_wcaf_fee_amount_subtotal( $subtotal ) { | |
$subtotal = 0; | |
$category_id = '61'; // Your category ID here. | |
$cart_items = WC()->cart->get_cart(); | |
foreach ( $cart_items as $key => $item ) { |
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 | |
/** | |
* Disable all sales. | |
* | |
* A simple function to disable all the sales in the shop. | |
* Uncomment the line of code to disable the sale price on products. | |
*/ | |
function custom_wc_get_sale_price( $sale_price, $product ) { |
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 custom_wc_coupon_validity( $valid, $product, $this, $values ) { | |
if ( $product->is_on_sale() ) { | |
return false; | |
} | |
return $valid; | |
} |
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 | |
/** | |
* WooCommerce Advanced Product Labels / Dynamic Pricing smart labels | |
*/ | |
function dynamic_pricing_advanced_product_labels_compat( $label ) { | |
global $product; | |
if ( ! $product ) : | |
$product_posts = get_posts( array( 'post_type' => 'product', 'posts_per_page' => 1 ) ); |
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_order_actions', 'custom_wc_order_action', 10, 1 ); | |
function custom_wc_order_action( $actions ) { | |
if ( is_array( $actions ) ) { | |
$actions['custom_action'] = __( 'My custom action' ); | |
} | |
return $actions; | |
} |
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_no_shipping_available_html', 'my_custom_no_shipping_message' ); | |
add_filter( 'woocommerce_cart_no_shipping_available_html', 'my_custom_no_shipping_message' ); | |
function my_custom_no_shipping_message( $message ) { | |
return __( 'A minimum of 6 products is required. Add more products to complete your purchase' ); | |
} |
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
/** | |
* Redirect to checkout at add-to-cart action. | |
*/ | |
function redirect_to_checkout() { | |
return WC()->cart->get_checkout_url(); | |
} | |
add_filter( 'woocommerce_add_to_cart_redirect', 'redirect_to_checkout' ); | |
------------------------------------ |
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
.wapl-label .label-yellow { | |
background-color: #f1c40f; | |
} |
NewerOlder