Skip to content

Instantly share code, notes, and snippets.

View DeveloperWil's full-sized avatar

Wil Brown DeveloperWil

View GitHub Profile
@DeveloperWil
DeveloperWil / woocommerce-change-add-to-cart-button-text-and-url.php
Last active January 11, 2024 08:47
WooCommerce: Change Add To Cart Button Text and URL
/**
* Removes the default Add To Cart button from the WooCommerce loop
* This will affect all products site-wide
*
* @author Wil Brown zeropointdevelopment.com
*/
function zpd_remove_wc_loop_add_to_cart_button(){
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
}
@DeveloperWil
DeveloperWil / woocommerce-display-product-reviews-shortcode.php
Created December 4, 2020 01:55
WooCommerce: Display Product Reviews Shortcode
/**
* 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
*
@DeveloperWil
DeveloperWil / woocommerce-return-array-of-featured-product-ids
Last active November 16, 2020 04:27
WooCommerce: Return an array of featured product IDs
@DeveloperWil
DeveloperWil / woocommerce-rename-product-tabs
Created November 16, 2020 04:07
WooCommerce: Rename Product Tabs
/**
* Rename the default WooCommerce product tabs
*
* @author Wil Brown zeropointdevelopment.com
* @param $tabs
* @return mixed
*/
function zpd_wc_rename_product_tabs($tabs) {
global $post;
@DeveloperWil
DeveloperWil / woocommerce-display-product-already-in-cart
Created November 16, 2020 03:25
WooCommerce: Display "Already in cart - add again?" for Add to Cart button
/**
* Change "Add to cart" button text on single product page
*
* @author Wil Brown zeropointdevelopment.com
* @return string|void
*/
function zpd_wc_add_to_cart_again_button() {
global $woocommerce;
@DeveloperWil
DeveloperWil / woocommerce-change-out-of-stock-to-sold
Created November 16, 2020 03:13
WooCommerce: Change "Out of stock" message to "Sold"
/**
* Change "Out of stock" with "Sold"
*
* @author Wil Brown zeropointdevelopment.com
* @param $availability
* @return mixed
*/
function zpd_availability_filter_func($availability)
{
$availability['availability'] = str_ireplace( 'Out of stock', 'Sold', $availability['availability'] );
@DeveloperWil
DeveloperWil / woocommerce-add-custom-currency-label-description-and-symbol
Created November 16, 2020 02:33
WooCommerce: Add A Custom Currency Label, Description and Symbol
/**
* Add custom currency label to WooCommerce
*
* @author Wil Brown zeropointdevelopment.com
* @param $currencies
* @return mixed
*/
function zpd_add_wc_currency( $currencies ) {
$currencies['BANANA'] = __( 'Banana', 'woocommerce' );
@DeveloperWil
DeveloperWil / woocommerce-add-privacy-policy-checkbox-to-checkout.php
Created November 13, 2020 04:16
WooCommerce: Add Privacy Policy checkbox to checkout form
/**
* Add a privacy policy checkbox on the checkout form
*
* @author Wil Brown zeropointdevelopment.com
*/
function zpd_add_checkout_privacy_policy() {
woocommerce_form_field( 'privacy_policy', array(
'type' => 'checkbox',
'class' => array('form-row privacy'),
@DeveloperWil
DeveloperWil / add-features-image-to-wordpress-rss-feed
Last active October 6, 2020 08:14
Add Featured Image To WP RSS Feed
<?php
//This will prepend your WordPress RSS feed content with the featured image
function wbd_featured_image_in_rss_feed( $content ) {
global $post;
if( is_feed() ) {
if ( has_post_thumbnail( $post->ID ) ){
$prepend = '<div>' . get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'margin-bottom: 10px;' ) ) . '</div>';
$content = $prepend . $content;
}
}
@DeveloperWil
DeveloperWil / ZPD Contract.md
Last active July 29, 2023 22:50
The latest version of my ‘killer contract’ for web designers and developers

Zero Point Development Contract

  • Revised date: November 5th, 2017

Between [company name]

And [customer name].