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 ('add_to_cart_redirect', 'redirect_to_checkout'); | |
function redirect_to_checkout() { | |
global $woocommerce; | |
$checkout_url = $woocommerce->cart->get_checkout_url(); | |
return $checkout_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 | |
global $woocommerce; //Declare GLobal | |
$ourproduct = new WC_Product(629); //Initialize/fetch Product with id 629 | |
$attribute = $ourproduct->get_attributes( ); //Get the attributes for the above fetched product | |
echo $attribute['product-code']['name']; //Print The Attribute Name | |
echo $attribute['product-code']['value']; //Print the Attribute value | |
?> |
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
function sv_wc_measurement_price_calculator_amount_needed() { | |
wc_enqueue_js( ' | |
$( "input.amount_needed" ).attr( { "step" : "0.1", "type" : "number" } ); | |
' ); | |
} | |
add_action( 'wp_enqueue_scripts', 'sv_wc_measurement_price_calculator_amount_needed' ); |
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
/* | |
* Display Empty Categories | |
* | |
*/ | |
add_filter( 'woocommerce_product_subcategories_hide_empty', 'show_empty_categories', 10, 1 ); | |
function show_empty_categories ( $show_empty ) { | |
$show_empty = true; | |
return $show_empty; |
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 | |
global $woocommerce; | |
$ourproduct = new WC_Product(562); | |
print_r($ourproduct); | |
echo "<br>".$ourproduct->regular_price; | |
echo "<br>".$ourproduct->sale_price; | |
?> |
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 | |
global $woocommerce; | |
$order = new WC_Order(1255); | |
$order_coupons = $order->get_used_coupons(); | |
$coupon= $order_coupons[0]; | |
$coupon_value= new WC_Coupon($coupon); | |
echo $coupon_value->coupon_amount; | |
?> |
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
function woo_hide_product_categories_widget( $list_args ){ | |
$list_args[ 'hide_empty' ] = 1; | |
return $list_args; | |
} | |
add_filter( 'woocommerce_product_categories_widget_args', 'woo_hide_product_categories_widget' ); |
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
// Alter Terms and Conditions Error Message | |
function my_woocommerce_add_error( $error ) { | |
if( 'You must accept our Terms & Conditions.' == $error ) { | |
$error = 'Please check the box at the bottom of this page'; | |
} | |
return $error; | |
} | |
add_filter( 'woocommerce_add_error', 'my_woocommerce_add_error' ); |
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
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 ); |
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
remove_action( ‘woocommerce_before_shop_loop’, ‘woocommerce_result_count’, 20 ); |