Skip to content

Instantly share code, notes, and snippets.

10Horizons 10horizons

View GitHub Profile
@10horizons
10horizons / template-awesome.php
Last active Feb 17, 2020
Woocommerce Upsell Popup PRO - example of custom popup template (for multiple upsell products)
View template-awesome.php
<?php
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! defined( 'thp-wc-upsell-popup-frzn' ) ) {
die('Undefined constant.');
}
/*
Template Name: My Awesome Template
@10horizons
10horizons / wc-display-all-products-eligible-for-coupons.php
Last active May 22, 2019
Display all Woocommerce products eligible for coupons created with Woocommerce
View wc-display-all-products-eligible-for-coupons.php
<?php
/*
URL: https://wproot.dev/blog/woocommerce-display-all-products-eligible-for-coupons/
*/
$args = array(
'posts_per_page' => -1, //show all posts
'post_type' => 'shop_coupon', //custom post type
'post_status' => 'publish', //published coupons only
);
@10horizons
10horizons / get-woocommerce-current-product-category-in-single-product-page.php
Last active May 22, 2019
Check for current product category in single product page (Woocommerce)
View get-woocommerce-current-product-category-in-single-product-page.php
<?php
/*
URL: https://wproot.dev/blog/get-woocommerce-current-product-category-single-product-page/
*/
if ( has_term( 'tshirts', 'product_cat' ) ) //product category is tshirts
{
$flatrate = '10.00';
}
elseif ( has_term( 'hoodies', 'product_cat' ) ) //product category is hoodies
You can’t perform that action at this time.