Skip to content

Instantly share code, notes, and snippets.

View 10horizons's full-sized avatar

10Horizons 10horizons

View GitHub Profile
<?php
function my_upsell_popup_scripts_enqueue () {
if ( is_page( 13 ) ) { //CHANGE 13 TO THE ID OF YOUR PAGE!
wp_enqueue_script( 'thp-flickity-js', get_site_url().'/wp-content/plugins/woocommerce-upsell-popup-pro/js/flickity.pkgd.min.js', array('jquery'), '', false );
wp_enqueue_style( 'thp-flickity-style', get_site_url().'/wp-content/plugins/woocommerce-upsell-popup-pro/css/flickity.min.css' );
wp_enqueue_style( 'thp-flickity-style-fix', get_site_url().'/wp-content/plugins/woocommerce-upsell-popup-pro/css/fix.min.css' );
@10horizons
10horizons / template-awesome.php
Last active January 17, 2021 23:56
Woocommerce Upsell Popup PRO - example of custom popup template (for multiple upsell products)
<?php
/*
Template Name: My Awesome Template
Uses Slider: No
*/
@10horizons
10horizons / wc-display-all-products-eligible-for-coupons.php
Last active May 22, 2019 13:17
Display all Woocommerce products eligible for coupons created with Woocommerce
<?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 13:16
Check for current product category in single product page (Woocommerce)
<?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