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 11, 2016 09:49
change the label to the button "Quote" in Remy Theme
<?php
add_filter( 'ywraq_product_add_to_quote', 'custom_quote_button_text', 12, 1 );
/**
* Change the label to the button "Quote" in Remy Theme
* @param $default
*
* @return string
*/
@kreamweb
kreamweb / frontend.js
Last active May 26, 2016 12:25
this code fix the problem of update the quantity automatically when the theme use a different quantity field
var request;
$(document).on( 'click', '.product-quantity input', function(e){
if( typeof request !== 'undefined' ){
request.abort();
}
var $t = $(this),
$input_quantity = $t.closest('.product-quantity').find('.input-text.qty'),
name = $input_quantity.attr('name'),
@kreamweb
kreamweb / functions.php
Created May 31, 2016 11:02
add cart messages on mini cart
<?php
if( class_exists( 'YWCM_Cart_Message' ) && get_option( 'ywcm_show_in_cart' ) == 'yes' ){
add_action('woocommerce_before_mini_cart', 'print_cart_messages' );
function print_cart_messages(){
$messages = YWCM_Cart_Message()->get_messages();
global $YWCM_Instance;
foreach ( $messages as $message ) {
$message_type = get_post_meta( $message->ID, '_ywcm_message_type', true );
$layout = ( get_post_meta( $message->ID, '_ywcm_message_layout', true ) !== '' ) ? get_post_meta( $message->ID, '_ywcm_message_layout', true ) : 'layout';
@kreamweb
kreamweb / functions.php
Created June 3, 2016 11:26
add only a product in the cart if subscription is installed
if ( class_exists( 'YITH_WC_Subscription' ) ) {
remove_filter( 'woocommerce_add_to_cart_validation', array( YITH_WC_Subscription(), 'cart_item_validate' ), 11 );
add_filter( 'woocommerce_add_to_cart_validation', 'ywsbs_cart_item_validate', 10, 4 );
/**
* Only a product can be added to the cart this method check if there's
* a product in cart and remove the element present in cart
@kreamweb
kreamweb / functions.php
Created June 20, 2016 10:26
function to add a cart message in the added to cart popup
/* this action add cart message in the added to cart popup */
add_action('yith_wacp_before_popup_content', 'yith_wacp_before_popup_content');
function yith_wacp_before_popup_content(){
if( class_exists('YWCM_Cart_Messages')){
global $YWCM_Instance;
$YWCM_Instance->print_message();
}
}
@kreamweb
kreamweb / functions.php
Created June 20, 2016 10:47
add register form to YITH Woocommerce Popup
<?php
add_shortcode( 'wcloginform', array( $this, 'aakoot_render_login_form' ) );
public function aakoot_render_login_form( $atts, $content = null ) {
ob_start();
if ( !is_user_logged_in() ) {
echo '<div class="woocommerce">';
wc_get_template( 'myaccount/form-login.php' );
echo '</div>';
@kreamweb
kreamweb / scratch_1.php
Last active November 16, 2016 08:33
move request a quote button - add this code in the file functions.php of your theme
<?php
/* To move request a quote button in the loop */
if( class_exists('YITH_Request_Quote_Premium')){
remove_action( 'woocommerce_after_shop_loop_item', array( YITH_Request_Quote_Premium(), 'add_button_shop' ), 15 );
add_action( 'your_loop_hook', array( YITH_Request_Quote_Premium(), 'add_button_shop' ) );
}
/* To move request a quote button in the single page */
if( class_exists('YITH_YWRAQ_Frontend') ){
@kreamweb
kreamweb / style.css
Created June 24, 2016 15:16
YITH Ajax Search - Flatsom Compatibility
/* NEW HEADER STYLE */
#masthead #logo {
width: 190px;
height: auto;
}
#masthead .right-links {
width: 1px;
}
@kreamweb
kreamweb / functions.php
Last active February 21, 2024 10:17
woocommerce-shipping-filter
<?php
/* this function remove free shipping if the discount of dynamic is applied in the cart */
if( class_exists('YITH_WC_Dynamic_Discounts') ){
add_filter( 'woocommerce_shipping_packages', 'show_packages' );
function show_packages($packages){
$label = YITH_WC_Dynamic_Discounts()->label_coupon;
$newpack = $packages;
foreach ( $packages as $key_package => $package ) {
if( isset( $package['applied_coupons'] ) && in_array( $label, $package['applied_coupons'] ) ){
if ( sizeof( $package['rates'] ) > 0 ) {
@kreamweb
kreamweb / functions.php
Last active August 3, 2016 05:01
change the name 'quote_xx.pdf' in yith woocommerce request a quote premium
<?php
if( function_exists('YITH_Request_Quote_Premium') ){
add_filter('ywraq_pdf_file_name','ywraq_pdf_file_name', 10, 2);
function ywraq_pdf_file_name( $filename, $quote_id ){
return 'custom_name_'.$quote_id.'.pdf';
}
}