Skip to content

Instantly share code, notes, and snippets.

View kreamweb's full-sized avatar

Emanuela Antonina Castorina kreamweb

  • Kream di Emanuela Castorina
  • Acicatena (CT) - Italy
View GitHub Profile
@kreamweb
kreamweb / functions.php
Created May 17, 2017 08:06
How test email of subscriptions
<?php
//test email renew_reminder
add_action( 'init', 'ywsbs_sendemail');
function ywsbs_sendemail(){
if( class_exists( 'YWSBS_Subscription') ) {
$subscription = new YWSBS_Subscription( 361 );
do_action( 'ywsbs_customer_subscription_renew_reminder_mail', $subscription );
}
}
@kreamweb
kreamweb / functions.php
Created May 9, 2017 13:03
floor points
<?php
add_filter('ywpar_get_product_point_round','ywpar_get_product_point_round', 10 );
function ywpar_get_product_point_round( $points ){
return floor( $points );
}
@kreamweb
kreamweb / functions.php
Created May 5, 2017 13:50
Only Payapal at checkout
<?php
/**
* Leave only Paypal, if there is a product with subscription on cart
*/
function ywsbs_only_paypal_for_subscriptions( $gateways ) {
if ( yith_added_product_as_subscription_on_cart() ) {
foreach ( $gateways as $k => $gateway ) {
if ( false === strpos( $gateway, 'WC_Gateway_Paypal' ) ) {
@kreamweb
kreamweb / functions.php
Created April 30, 2017 08:06
shop manager manage tabs
<?php
add_filter('ywpar_show_tab_to_shop_manager', 'ywpar_show_tab_to_shop_manager', 10, 2);
function ywpar_show_tab_to_shop_manager( $shop_manager_tabs, $admin_tabs ) {
if ( isset( $admin_tabs['roles'] ) ) {
unset( $admin_tabs['roles'] );
}
return $admin_tabs;
}
@kreamweb
kreamweb / new_gist_file_0
Created April 26, 2017 07:37
increase the limit of items per pages in the exclusion list
<?php
add_filter('ywraq_exclusion_limit', 'ywraq_exclusion_limit');
function ywraq_exclusion_limit(){
return 500;
}
@kreamweb
kreamweb / functions.php
Created April 4, 2017 15:14
DIVI Raq Compatibily
<?php
if( class_exists('YITH_YWRAQ_Frontend') ){
add_action('template_redirect','ywraq_show_button_single_product_page');
function ywraq_show_button_single_product_page(){
remove_action( 'woocommerce_before_single_product', array( YITH_YWRAQ_Frontend(), 'show_button_single_page' ) );
add_action( 'woocommerce_single_product_summary', array( YITH_YWRAQ_Frontend(), 'show_button_single_page' ) );
}
}
@kreamweb
kreamweb / functions.php
Created March 21, 2017 09:09
This code return the images of logo and thumbnails path instead of URL that isn't supported by some server
<?php
if( defined('YITH_YWRAQ_PREMIUM') ){
add_filter( 'ywraq_pdf_logo', 'ywraq_change_pdf_logo' );
function ywraq_change_pdf_logo( $logo ) {
$logo_id = get_option( 'ywraq_pdf_logo-yith-attachment-id' );
$logo = get_attached_file( $logo_id );
@kreamweb
kreamweb / functions.php
Created February 23, 2017 09:59
add a message to customer with the date of next payment
<?php
if ( defined( 'YITH_YWSBS_PREMIUM' ) ) {
add_action( 'woocommerce_init', 'ywsbs_add_notice' );
function ywsbs_add_notice(){
if( is_user_logged_in()){
$current_user = wp_get_current_user();
$sbs = YITH_WC_Subscription()->get_user_subscriptions( $current_user->get('ID'), $status = 'active' );
foreach ( $sbs as $sub_id ){
$subscription = ywsbs_get_subscription( $sub_id );
@kreamweb
kreamweb / functions.php
Created February 21, 2017 11:16
function to hide show popup in mobile / desktop
<?php
function ywpop_hide_popup(){
if ( ! class_exists( 'YITH_Popup_Frontend' ) ) {
return;
}
$current_popup = YITH_Popup_Frontend()->get_current_popup();
@kreamweb
kreamweb / functions.php
Created February 21, 2017 08:54
function that hide the popup in a specific category function that changes a popup in a specific category
<?php
add_action( 'template_redirect', 'ywpop_hide_popup', 9);
function ywpop_hide_popup(){
if( is_product_category() ){
add_filter( 'enable_yit_popup', '__return_false');
}
}
add_action( 'template_redirect', 'ywpop_change_popup', 9);