Skip to content

Instantly share code, notes, and snippets.

@rynaldos-zz
rynaldos-zz / wc-cc-shop-php
Last active September 6, 2017 18:11
[WooCommerce 3.0] Show currency converter on shop / archive page
add_filter( 'woocommerce_get_price_html', 'wc_ninja_add_sc_price_display', 20 );
function wc_ninja_add_sc_price_display( $price ) {
echo do_shortcode( '[woocommerce_currency_converter] ' );
return $price;
}
function custom_flatsome_woocommerce_shop_loop_excerpt(){
if(!flatsome_option('short_description_in_grid')) return; ?>
<p class="box-excerpt is-small">
<?php /*echo get_the_excerpt();*/ ?>
<?php echo wp_trim_words( get_the_excerpt(), 10); ?>
</p>
<?php
}
add_action('flatsome_product_box_after', 'custom_flatsome_woocommerce_shop_loop_excerpt', 21);
@damiencarbery
damiencarbery / class-wc-check-availability-email.php
Last active October 25, 2017 10:32
Add custom email to WooCommerce
<?php
/**
* An email to ask the vendor to check availability of a booking.
*
* @extends \WC_Email
*
* Code copied from: https://www.skyverge.com/blog/how-to-add-a-custom-woocommerce-email/
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
<?php
/**
* Client wants only logged in users to see prices and buy non-sale items while allowing all users to see prices and buy
* on sale items
*/
/**
*
* filters woocommerce_is_purchasable for not onsale items
*
@hostedpixel
hostedpixel / gist:c9f3f015e0df0eb83971be298f41c57e
Created June 21, 2017 19:38
Woocommerce | Send email when product review is approved.
add_action('comment_unapproved_to_approved', 'comment_approved');
function comment_approved($comment) {
$comment_product_id = $comment ->comment_post_ID;
if ( get_post_type($comment_product_id) == 'product' ) {
//if is true
@dancameron
dancameron / functions.php
Created June 15, 2017 23:55
Disable Invoice Generation when Estimate is Accepted
<?php // don't include this in your functions.php, since the start of the file should already have it
add_filter( 'si_disable_create_invoice_on_est_acceptance', '__return_true' );
@dancameron
dancameron / functions.php
Created June 15, 2017 17:51
Automatically Send Invoice After Set to Pending
<?php // don't include this in your functions.php, since the start of the file should already have it
function maybe_send_invoice_notification( SI_Invoice $invoice, $status = '' ) {
if ( SI_Invoice::STATUS_PENDING === $status ) {
$client = $invoice->get_client();
if ( ! is_a( $client, 'SI_Client' ) ) {
return;
}
$recipients = $client->get_associated_users();
if ( empty( $recipients ) ) {
@igorbenic
igorbenic / desc.php
Last active February 21, 2024 21:32
How to Programmatically Change Yoast SEO Open Graph Meta | http://www.ibenic.com/programmatically-change-yoast-seo-open-graph-meta
<?php
function change_yoast_seo_og_meta() {
add_filter( 'wpseo_opengraph_desc', 'change_desc' );
}
function change_desc( $desc ) {
// This article is actually a landing page for an eBook
if( is_singular( 123 ) ) {
<?php
// Remove that PHP above if you are having errors come up after saving the file.
/**
* Hide shipping rates when free shipping is available.
* Updated to support WooCommerce 2.6 Shipping Zones.
*
* @param array $rates Array of rates found for the package.
* @return array
*/
@dancameron
dancameron / invoice.php
Last active June 19, 2017 08:13
Invoice Template Modification
<?php
/**
* DO NOT EDIT THIS FILE! Instead customize it via a theme override.
*
* Any edit will not be saved when this plugin is upgraded. Not upgrading will prevent you from receiving new features,
* limit our ability to support your site and potentially expose your site to security risk that an upgrade has fixed.
*
* https://sproutapps.co/support/knowledgebase/sprout-invoices/customizing-templates/
*