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
<div class="woocommerce product compare-button"> | |
<?php | |
echo '<a href="' . get_permalink( $product->id ) . '&action=yith-woocompare-add-product&id=' . $product->id . '" class="compare button" data-product_id="' . $product->id . '"><i class="fa fa-refresh"></i></a>'; | |
?> | |
</div> |
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
// Use It In functions.php | |
add_filter( 'woocommerce_enable_order_notes_field', '__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
function wcs_stock_text_shop_page() { | |
//returns an array with 2 items availability and class for CSS | |
global $product; | |
$availability = $product->get_availability(); | |
//check if availability in the array = string 'Out of Stock' | |
//if so display on page.//if you want to display the 'in stock' messages as well just leave out this, == 'Out of stock' | |
if ( $availability['availability'] == 'Out of stock') { | |
echo apply_filters( 'woocommerce_stock_html', '<span class="' . esc_attr( $availability['class'] ) . '">' . esc_html( $availability['availability'] ) . '</p>', $availability['availability'] ); | |
} |
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 | |
/** | |
* Change the add to cart text on single product pages | |
*/ | |
add_filter('woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text'); | |
function woo_custom_cart_button_text() { | |
foreach( WC()->cart->get_cart() as $cart_item_key => $values ) { | |
$_product = $values['data']; | |
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
function wc_ninja_custom_variable_price( $price, $product ) { | |
// Main Price | |
$prices = array( $product->get_variation_price( 'min', true ), $product->get_variation_price( 'max', true ) ); | |
$price = $prices[0] !== $prices[1] ? sprintf( __( 'From: %1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] ); | |
// Sale Price | |
$prices = array( $product->get_variation_regular_price( 'min', true ), $product->get_variation_regular_price( 'max', true ) ); | |
sort( $prices ); | |
$saleprice = $prices[0] !== $prices[1] ? sprintf( __( 'From: %1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] ); | |
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
/** | |
* woocommerce_package_rates is a 2.1+ hook | |
*/ | |
add_filter( 'woocommerce_package_rates', 'hide_shipping_when_free_is_available', 10, 2 ); | |
/** | |
* Hide shipping rates when free shipping is available | |
* | |
* @param array $rates Array of rates found for the package | |
* @param array $package The package array/object being shipped |
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 | |
// Display Fields | |
add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' ); | |
function woo_add_custom_general_fields() { | |
global $woocommerce, $post; | |
echo '<div class="options_group">'; | |