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
/** | |
* Set a minimum amount for checkout | |
*/ | |
function zpd_wc_minimum_order_amount(): void { | |
/** | |
* $minimum is the minimum value you want to set the checkout total order amount. | |
*/ | |
$minimum = 50; | |
/** |
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
/** | |
* Change the default shop page 'catalogue' order of how products are displayed | |
* | |
* You can use the following parameters: | |
* 'menu_order' – by the custom order first, then by product name (Default) | |
* 'popularity' – by the number of sales | |
* 'rating' – by the average rating | |
* 'date' – recently added products will be displayed first | |
* 'price' – cheapest products will be displayed first | |
* 'price-desc' – the most expensive first |
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 extra emails to the WC email sent when an order has been completed. | |
* | |
* Make sure you separate multiple emails with a comma. | |
* | |
* @param $recipient | |
* @param $object | |
* @return string | |
*/ | |
function zpd_wc_extra_email_recipient( $recipient, $object ): string { |
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
/** | |
* Removes commenting from WordPress | |
* | |
* Redirects edit comment URL to admin URL | |
* Removes comment meta box | |
* Removes comments and trackback support for all post types | |
*/ | |
function zpd_remove_commenting () { | |
// Redirect any user trying to access comments page | |
global $pagenow; |
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
/** | |
* Finds product varant option dropdown with " - sold out" and adds a "sold-out" class to the option. | |
* You can add the following CSS to grey-out the sold out option | |
* option.sold-out{ color:lightgray;} | |
*/ | |
jQuery(window).load(function(){ | |
jQuery('body.single-product .product.type-product table.variations td.value select option').each(function( index ){ | |
var optionText = jQuery(this).text(); | |
if( optionText.indexOf(" - sold out") >= 0 ){ | |
jQuery(this).addClass( 'sold-out' ); |
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
/** | |
* Generate an order ID based on the billing customers initials and a random number between 10000 and 99999 | |
* | |
* @author Wil Brown zeropointdevelopment.com | |
* @param $order_id | |
* | |
* @return string | |
* @throws Exception | |
*/ | |
function zpd_change_woocommerce_order_number( $order_id ) { |
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 a shortcode to display product reviews. | |
* Format: [product_reviews id="123"] | |
* id = the product ID - you can get this from Products > All Products and hovering over the product title | |
* | |
* If there are no reviews for a product, nothing is returned to the browser. | |
* | |
* @author Wil Brown zeropointdevelopment.com | |
* @param $atts | |
* |
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
/** | |
* Return a list (array) of WooCommerce featured product IDs | |
* | |
* @author Wil Brown zeropointdevelopment.com | |
* @return array|mixed | |
*/ | |
function zpd_wc_get_featured_product_ids() { | |
// Load from cache | |
$featured_product_ids = get_transient( 'zpd_wc_featured_products' ); |
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
/** | |
* Rename the default WooCommerce product tabs | |
* | |
* @author Wil Brown zeropointdevelopment.com | |
* @param $tabs | |
* @return mixed | |
*/ | |
function zpd_wc_rename_product_tabs($tabs) { | |
global $post; |