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 | |
// check for empty-cart get param to clear the cart | |
add_action( 'init', 'woocommerce_clear_cart_url' ); | |
function woocommerce_clear_cart_url() { | |
global $woocommerce; | |
if ( isset( $_GET['empty-cart'] ) ) { | |
$woocommerce->cart->empty_cart(); | |
} | |
} |
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 | |
function patricks_woocommerce_catalog_orderby( $orderby ) { | |
// Add "Sort by date: oldest to newest" to the menu | |
// We still need to add the functionality that actually does the sorting | |
$orderby['oldest_to_recent'] = __( 'Sort by date: oldest to newest', 'woocommerce' ); | |
// Change the default "Sort by newness" to "Sort by date: newest to oldest" | |
$orderby["date"] = __('Sort by date: newest to oldest', 'woocommerce'); | |
// Remove price & price-desc |
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 | |
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
<?php | |
// Add "Sort by date: oldest to newest" to the menu | |
// We still need to add the functionality that actually does the sorting | |
// Original credit to Remi Corson: http://www.remicorson.com/woocommerce-sort-products-from-oldest-to-most-recent/ | |
function patricks_woocommerce_catalog_orderby( $sortby ) { | |
$sortby['oldest_to_recent'] = __( 'Sort by date: oldest to newest', 'woocommerce' ); | |
return $sortby; | |
} | |
add_filter( 'woocommerce_catalog_orderby', 'patricks_woocommerce_catalog_orderby', 20 ); |
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 | |
// Modify the default WooCommerce orderby dropdown | |
// | |
// Options: menu_order, popularity, rating, date, price, price-desc | |
// In this example I'm changing the default "Sort by newness" to "Sort by date: newest to oldest" | |
function patricks_woocommerce_catalog_orderby( $orderby ) { | |
$orderby["date"] = __('Sort by date: newest to oldest', 'woocommerce'); | |
return $orderby; | |
} | |
add_filter( "woocommerce_catalog_orderby", "patricks_woocommerce_catalog_orderby", 20 ); |
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 | |
add_filter( 'woocommerce_cart_needs_shipping', '__return_true' ); |
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
.single_add_to_cart_button.fa:before { | |
padding-right: 10px; | |
} |
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
<button type="submit" class="single_add_to_cart_button button alt fa fa-arrow-right"><?php echo esc_html( $product->single_add_to_cart_text() ); ?></button> |
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 | |
// removes the meta information | |
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 ); | |
// adds the meta information after all other product data | |
add_action( 'woocommerce_after_single_product_summary', 'woocommerce_template_single_meta', 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
<div class="summary entry-summary"> | |
<?php | |
/** | |
* woocommerce_single_product_summary hook. | |
* | |
* @hooked woocommerce_template_single_title - 5 | |
* @hooked woocommerce_template_single_rating - 10 | |
* @hooked woocommerce_template_single_price - 10 | |
* @hooked woocommerce_template_single_excerpt - 20 |