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_action( 'woocommerce_cart_totals_after_order_total', 'uw_display_cart_totals_after' ); | |
add_action( 'woocommerce_review_order_after_order_total', 'uw_display_cart_totals_after' ); | |
/** | |
* Pulls in cart totals and adds a new table row to the cart/checkout totals | |
* | |
* @author UltimateWoo - https://www.ultimatewoo.com | |
*/ | |
function uw_display_cart_totals_after() { |
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 a custom tab to WooCommerce products | |
* | |
* @param (array) $tabs - Registered tabs | |
* @return (array) $tabs - Updated array of tabs | |
* | |
* @author UltimateWoo <www.ultimatewoo.com> | |
*/ |
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 | |
/** | |
* Sidebar-Content Layout on Product category archives | |
* | |
* @author UltimateWoo <www.ultimatewoo.com>; | |
*/ | |
function ultimatewoo_wc_product_cat_genesis_layout() { | |
if ( is_tax( 'product_cat' ) ) { | |
return 'sidebar-content'; |
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 | |
/** | |
* Retrieve top selling products | |
* | |
* @param (int) $posts_per_page - Number of products to retrieve | |
* @return (array) Product posts | |
* @author UltimateWoo https://www.ultimatewoo.com | |
*/ | |
function uw_woocommerce_get_top_selling_products( $posts_per_page = 5 ) { |
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 if the current user has an active subscription. | |
* Redirect the user if no active subscription and the current post is a singule forum. | |
* This code should not be copied and pasted as is. It is only to demonstrate the wcs_user_has_subscription() function. | |
* | |
* wcs_user_has_subscription( $user_id = 0, $product_id = '', $status = 'any' ) | |
* @param int (optional) The ID of a user in the store. If left empty, the current user's ID will be used. | |
* @param int (optional) The ID of a product in the store. If left empty, the function will see if the user has any subscription. |
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 custom states to country in WooCommerce (Ex: Nigeria) | |
*/ | |
add_filter( 'woocommerce_states', 'NG_woocommerce_states' ); | |
function NG_woocommerce_states( $states ) { | |
$states['NG'] = array( | |
'SS' => __( 'Some State', 'woocommerce' ), |
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 | |
/** | |
* Reposition the points table, generated by the Points and Rewards module, from the top to the bottom of the My Account page. | |
* @author UltimateWoo | |
* @link https://www.ultimatewoo.com/how-to-reposition-woocommerce-points-and-rewards-account-table/ | |
*/ | |
remove_action( 'woocommerce_before_my_account', 'woocommerce_points_rewards_my_points' ); | |
add_action( 'woocommerce_after_my_account', 'woocommerce_points_rewards_my_points' ); |
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 | |
if ( is_shop() || is_product_category() || is_product_tag() ) { // Only run on shop archive pages, not single products or other pages | |
// Products per page | |
$per_page = 24; | |
if ( get_query_var( 'taxonomy' ) ) { // If on a product taxonomy archive (category or tag) | |
$args = array( |
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 | |
/* | |
Plugin Name: WooCommerce Conditional Upsells | |
Plugin URI: http://www.ultimatewoo.com/woocommerce-conditional-upsells | |
Description: This is a fork of another Gist that we have put into plugin format. Define a list of Upsell products and a list of Required products. Upsells will be shown as an option to add to cart when all required products are currently in cart. They'll also be removed when a required product is removed. | |
Version: 1.0 | |
Author: UltimateWoo | |
Author URI: http://www.ultimatewoo.com/ | |