Skip to content

Instantly share code, notes, and snippets.

Emanuela Antonina Castorina kreamweb

  • Kream di Emanuela Castorina
  • Acicatena (CT) - Italy
Block or report user

Report or block kreamweb

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
View functions.php
<?php
if ( isset( $_GET['ywpar_fix_points7'] ) ) {
add_action( 'init', 'start_the_script7' );
function start_the_script7() {
global $wpdb;
$table_name = $wpdb->prefix . 'yith_ywpar_points_log';
$limit = 10;
@kreamweb
kreamweb / functions.php
Created Nov 29, 2018
Call URL?points_update=1 to update points
View functions.php
<?php
function ywpar_calculate_rewarded_points( $user_id ){
global $wpdb;
$table_name = $wpdb->prefix . 'yith_ywpar_points_log';
$query = "SELECT SUM(ywpar_points.amount) as rewarded_points FROM $table_name as ywpar_points where user_id = $user_id AND action = 'redeemed_points'";
$res = $wpdb->get_row( $query );
@kreamweb
kreamweb / functions.php
Created Nov 7, 2018
add custom fields from the parent order to the renew order
View functions.php
<?php
if ( class_exists( 'YITH_WC_Subscription' ) ) {
add_action( 'ywsbs_renew_subscription', 'ywsbs_renew_subscription_add_custom_field', 10, 2 );
function ywsbs_renew_subscription_add_custom_field( $order_id, $subscription_id ) {
$subscription = ywsbs_get_subscription( $subscription_id );
$parent_order = $subscription->get_order();
$renew_order = wc_get_order( $order_id );
$meta_list = array(
'_billing_birthdate',
@kreamweb
kreamweb / class.product-gtin-wc.php
Created Oct 26, 2018
Added custom_products_api_data
View class.product-gtin-wc.php
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* The core plugin class.
*
* This is used to define internationalization, general hooks, and
View file.php
<?php
add_action('wp', function(){ echo '<pre>';print_r($GLOBALS['wp_filter']); echo '</pre>';exit; } );
@kreamweb
kreamweb / request-quote-view.php
Created Sep 18, 2018
override the standard template of table list inside the folder woocommerce of your theme
View request-quote-view.php
<?php
/**
* This file belongs to the YIT Plugin Framework.
*
* This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://www.gnu.org/licenses/gpl-3.0.txt
*/
@kreamweb
kreamweb / functions.php
Created Sep 13, 2018
Change the Set Express Checkout Request parameters on YITH PayPal Express Checkout for WooCommerce
View functions.php
<?php
add_filter('yith_paypal_ec_set_express_checkout_request_parameters', 'yith_paypal_ec_set_express_checkout_request_parameters');
function yith_paypal_ec_set_express_checkout_request_parameters( $args ){
$args['NOSHIPPING'] = 2;
$args['ADDROVERRIDE'] = 1;
return $args;
}
@kreamweb
kreamweb / functions.php
Created Jun 29, 2018
Fix to remove the conflict between YITH WooCommerce Request a Quote and WooCommerce Subscription when a request of quote is sent.
View functions.php
<?php
/**
* Fix to remove the conflict between YITH WooCommerce Request a Quote and WooCommerce Subscription
* when a request of quote is sent.
*/
add_action('ywraq_before_create_order', 'ywraq_fix_woocommerce_subscription_conflict');
function ywraq_fix_woocommerce_subscription_conflict(){
remove_filter( 'woocommerce_payment_complete_order_status', 'WC_Subscriptions_Order::maybe_autocomplete_order', 10 );
View functions.php
<?php
if ( function_exists( 'ywsbs_get_subscription' ) ) {
add_action( 'ywsbs_renew_subscription', 'ywsbs_renew_subscription_additional_fields', 10, 2 );
function ywsbs_renew_subscription_additional_fields( $renew_order_id, $subscription_id ) {
$subscription = ywsbs_get_subscription( $subscription_id );
$order_id = $subscription->order_id;
$billing_persontype = get_post_meta( $order_id, '_billing_persontype', true );
$billing_cpf = get_post_meta( $order_id, '_billing_cpf', true );
@kreamweb
kreamweb / functions.php
Created Jun 17, 2018
use this function to get the points earned in a single order.
View functions.php
<?php
function get_total_user_point( $order ) {
$user_id = false;
if ( !$order instanceof WC_Order ) {
$order = wc_get_order( $order );
}
$user_id = $order->get_user_id();
You can’t perform that action at this time.