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
<?php
if (defined('YITH_POS_VERSION')) {
add_action( 'wp_enqueue_scripts', 'yith_pos_add_new_stylesheet', 12 );
function yith_pos_add_new_stylesheet(){
global $yith_pos_styles;
wp_enqueue_style('yith-pos-override-frontend', get_stylesheet_directory_uri().'/pos.css', array('yith-pos-frontend'), YITH_POS_VERSION);
yith_pos_enqueue_style('yith-pos-override-frontend');
}
<?php
if ( ! function_exists( 'yith_pos_customization_barcode_field' ) ) {
add_filter( 'yith_pos_barcode_custom_field', 'yith_pos_customization_barcode_field' );
function yith_pos_customization_barcode_field() {
return "your_barcode_custom_field";
}
}
<?php
if ( ! function_exists( 'yith_pos_customization_css' ) ) {
add_action( 'wp_enqueue_scripts', 'yith_pos_customization_css', 99 );
function yith_pos_customization_css() {
$css = ".yith-pos-product-list__list .product, .yith-pos-product-category-list__list .product-cat{
height: 150px;
}";
wp_add_inline_style( 'yith-pos-frontend', $css );
<?php if ( ! function_exists( 'yith_pos_customization_order_status_to_complete' ) ) {
add_filter( 'woocommerce_payment_complete_order_status', 'yith_pos_customization_order_status_to_complete', 10, 3 );
function yith_pos_customization_order_status_to_complete( $status, $order_id, $order ) {
if ( absint( $order->get_meta( '_yith_pos_order' ) ) ) {
$status = 'completed';
}
return $status;
}
@kreamweb
kreamweb / yith_ywdpd_table_pricing.php
Created June 4, 2019 07:58
Table that show buy x | Price | Discount
<?php
remove_filter( 'woocommerce_'.YITH_WC_Dynamic_Pricing_Frontend()->get_product_filter.'get_price', array( YITH_WC_Dynamic_Pricing_Frontend(), 'get_price' ) );
remove_filter( 'woocommerce_' . YITH_WC_Dynamic_Pricing_Frontend()->get_product_filter . 'variation_get_price', array( YITH_WC_Dynamic_Pricing_Frontend(), 'get_price' ) );
$tax_display_mode = get_option( 'woocommerce_tax_display_shop' );
if ( $label_table != '' ):
?>
<p class="ywdpd-table-discounts-label"><strong><?php echo $label_table ?></strong>
<?php if ( $until != '' ) {
echo "<span>$until</span>";
<?php
add_filter( 'ywdpd_round_total_price', 'ywdpd_round_price_for_single_product' );
function ywdpd_round_price_for_single_product(){
return false;
}
<?php
if ( isset( $_GET['ywpar_fix_points8'] ) ) {
add_action( 'init', 'start_the_script7' );
function start_the_script7() {
global $wpdb;
$table_name = $wpdb->prefix . 'yith_ywpar_points_log';
$limit = 10;
$users = $wpdb->get_col( "select distinct point.user_id from $table_name as point WHERE NOT EXISTS (
@kreamweb
kreamweb / functions.php
Created November 29, 2018 08:05
Call URL?points_update=1 to update points
<?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 November 7, 2018 16:47
add custom fields from the parent order to the renew order
<?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 October 26, 2018 14:47
Added custom_products_api_data
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* The core plugin class.
*
* This is used to define internationalization, general hooks, and