Skip to content

Instantly share code, notes, and snippets.

10Horizons 10horizons

Block or report user

Report or block 10horizons

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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.